From a7c21c43acd08049262ca4cd15cee4f81572ab85 Mon Sep 17 00:00:00 2001 From: Henrik Bakken Date: Sat, 6 Nov 2021 11:51:11 +0100 Subject: [PATCH] updates & nvim config autoformat --- nvim/init.lua | 1284 ++++++++++++++++++++++++++----------------------- 1 file changed, 682 insertions(+), 602 deletions(-) diff --git a/nvim/init.lua b/nvim/init.lua index 380fa5b..d018950 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -19,7 +19,7 @@ opt.termguicolors = true opt.cmdheight = 2 opt.background = "dark" opt.listchars = "tab:→ ,trail:·,extends:↷,precedes:↶,nbsp:+,eol:↵" -opt.list = true -- Show listchars +opt.list = true -- Show listchars opt.showtabline = 2 -- undo @@ -29,41 +29,44 @@ opt.undolevels = 1000 opt.undoreload = 10000 -- window -opt.splitbelow = true -- Put new windows below current -opt.splitright = true -- Put new windows right of current +opt.splitbelow = true -- Put new windows below current +opt.splitright = true -- Put new windows right of current -- buffer -opt.hidden = true -- Enable background buffers -opt.wrap = false -- Disable line wrap -opt.number = true -- Show line numbers -opt.relativenumber = true -- Relative line numbers -opt.cursorline = false -- Highlight current line -opt.switchbuf = "useopen" -- Use existing window if buffer is already open +opt.hidden = true -- Enable background buffers +opt.wrap = false -- Disable line wrap +opt.number = true -- Show line numbers +opt.relativenumber = true -- Relative line numbers +opt.cursorline = false -- Highlight current line +opt.switchbuf = "useopen" -- Use existing window if buffer is already open opt.colorcolumn = "88" -- tabs -opt.expandtab = true -- Use spaces instead of tabs -opt.smartindent = false -- Avoid fucking with comment indents -opt.shiftround = true -- Round indent -opt.tabstop = 2 -- Number of spaces tabs count for -opt.shiftwidth = 2 -- Size of an indent +opt.expandtab = true -- Use spaces instead of tabs +opt.smartindent = false -- Avoid fucking with comment indents +opt.shiftround = true -- Round indent +opt.tabstop = 2 -- Number of spaces tabs count for +opt.shiftwidth = 2 -- Size of an indent -- search -opt.ignorecase = true -- Ignore case -opt.smartcase = true -- Do not ignore case with capitals -opt.wildmode = {"full"} -- Command-line completion mode +opt.ignorecase = true -- Ignore case +opt.smartcase = true -- Do not ignore case with capitals +opt.wildmode = {"full"} -- Command-line completion mode opt.wildignorecase = true -opt.wildignore = opt.wildignore + {"*swp", "*.class", "*.pyc", "*.png", "*.jpg", "*.gif", "*.zip", "*/tmp/*", "*.o", ".obj", "*.so"} +opt.wildignore = opt.wildignore + { + "*swp", "*.class", "*.pyc", "*.png", "*.jpg", "*.gif", "*.zip", "*/tmp/*", + "*.o", ".obj", "*.so" +} -- cursor -opt.scrolloff = 5 -- Lines of context -opt.scrolljump = 1 -- Lines to scroll when cursor leaves screen -opt.sidescrolloff = 4 -- Columns of context -opt.showmatch = true -- Show matching brackets / parentheses +opt.scrolloff = 5 -- Lines of context +opt.scrolljump = 1 -- Lines to scroll when cursor leaves screen +opt.sidescrolloff = 4 -- Columns of context +opt.showmatch = true -- Show matching brackets / parentheses -- editing -opt.joinspaces = false -- No double spaces with join -opt.timeoutlen = 500 -- How long to wait during key combo +opt.joinspaces = false -- No double spaces with join +opt.timeoutlen = 500 -- How long to wait during key combo opt.langmap = "å(,¨),Å{,^},Ø\\;,ø:,æ^,+$" opt.clipboard = opt.clipboard + {"unnamedplus"} @@ -89,7 +92,8 @@ vim.api.nvim_command [[autocmd!]] vim.api.nvim_command [[autocmd BufWritePost * %s/\s\+$//e]] vim.api.nvim_command [[autocmd BufWritePost *.py silent! execute ':Black']] vim.api.nvim_command [[autocmd BufReadPost quickfix nmap ]] -vim.api.nvim_command [[autocmd TextYankPost * "lua vim.highlight.on_yank {on_visual = false}"]] +vim.api + .nvim_command [[autocmd TextYankPost * "lua vim.highlight.on_yank {on_visual = false}"]] vim.api.nvim_command [[augroup END]] -- ---------------------------------------- @@ -103,624 +107,700 @@ local map = vim.api.nvim_set_keymap map("n", "Q", "", {noremap = true}) map("n", "q:", "", {noremap = true}) -map("n", "E", [[:so ~/.config/nvim/init.lua:PackerInstall:PackerCompile]], { noremap = true }) -map("n", "e", [[:vnew ~/dotfiles/nvim/init.lua]], { noremap = true }) -map("n", "nt", [[:vnew ~/notes/todos.md]], { noremap = true }) -map("n", "nc", [[:vnew ~/notes/cheatsheet.md]], { noremap = true }) -map("n", "nl", [[:vnew ~/notes/libs.md]], { noremap = true }) -map("n", "nu", [[:vnew ~/notes/urls.md]], { noremap = true }) -map("n", "nn", [[:Explore ~/notes]], { noremap = true }) -map("n", "ww", [[:cd %:p:h]], { noremap = true }) -map("n", "", ":noh", { silent = true, noremap = true } ) +map("n", "E", + [[:so ~/.config/nvim/init.lua:PackerInstall:PackerCompile]], + {noremap = true}) +map("n", "e", [[:vnew ~/dotfiles/nvim/init.lua]], {noremap = true}) +map("n", "nt", [[:vnew ~/notes/todos.md]], {noremap = true}) +map("n", "nc", [[:vnew ~/notes/cheatsheet.md]], {noremap = true}) +map("n", "nl", [[:vnew ~/notes/libs.md]], {noremap = true}) +map("n", "nu", [[:vnew ~/notes/urls.md]], {noremap = true}) +map("n", "nn", [[:Explore ~/notes]], {noremap = true}) +map("n", "ww", [[:cd %:p:h]], {noremap = true}) +map("n", "", ":noh", {silent = true, noremap = true}) -- to navigate the completion menu -map("i", "", [[pumvisible() ? "\" : "\"]], { expr = true, noremap = true }) -map("i", "", [[pumvisible() ? "\" : "\"]], { expr = true, noremap = true }) +map("i", "", [[pumvisible() ? "\" : "\"]], + {expr = true, noremap = true}) +map("i", "", [[pumvisible() ? "\" : "\"]], + {expr = true, noremap = true}) -- CURSOR -- stay visual when indenting -map("n", "-", "_", { noremap = true }) -map("v", "v", "", { noremap = true }) -map("v", "", ">gv", { noremap = true }) -map("v", "", "o", "m`o``", { noremap = true }) -- Insert a newline in normal mode +map("n", "-", "_", {noremap = true}) +map("v", "v", "", {noremap = true}) +map("v", "", ">gv", {noremap = true}) +map("v", "", "o", "m`o``", {noremap = true}) -- Insert a newline in normal mode -- repeat and next -map("n", "\\", "n.", { noremap = true }) +map("n", "\\", "n.", {noremap = true}) -- WINDOWS / BUFFERS -- make splits and tabs -map("n", "", ":vnew", { noremap = true }) -map("n", "", ":new", { noremap = true }) -map("n", "", ":vsplit", { noremap = true }) -map("n", "", ":split", { noremap = true }) -map("n", "", ":tabe %", { noremap = true }) -map("n", "", ":tabnew", { noremap = true }) +map("n", "", ":vnew", {noremap = true}) +map("n", "", ":new", {noremap = true}) +map("n", "", ":vsplit", {noremap = true}) +map("n", "", ":split", {noremap = true}) +map("n", "", ":tabe %", {noremap = true}) +map("n", "", ":tabnew", {noremap = true}) -- buffers and tabs -map("n", "", ":bprev", { noremap = true }) -map("n", "", ":bnext", { noremap = true }) -map("n", "", ":tabprev", { noremap = true }) -map("n", "", ":tabnext", { noremap = true }) +map("n", "", ":bprev", {noremap = true}) +map("n", "", ":bnext", {noremap = true}) +map("n", "", ":tabprev", {noremap = true}) +map("n", "", ":tabnext", {noremap = true}) -- resize windows with hjkl -map("n", "", "5<", { noremap = true }) -map("n", "", "5-", { noremap = true }) -map("n", "", "5+", { noremap = true }) -map("n", "", "5>", { noremap = true }) +map("n", "", "5<", {noremap = true}) +map("n", "", "5-", {noremap = true}) +map("n", "", "5+", {noremap = true}) +map("n", "", "5>", {noremap = true}) -- quickfix window -map("n", "", ":cp", { noremap = true }) -map("n", "", ":cn", { noremap = true }) +map("n", "", ":cp", {noremap = true}) +map("n", "", ":cn", {noremap = true}) -- remove buffer -map("n", "", ":bprev:bd#", { noremap = true }) -map("n", "", ":bprev:bd!#", { noremap = true }) -map("n", "", ":checkt", { noremap = true }) +map("n", "", ":bprev:bd#", {noremap = true}) +map("n", "", ":bprev:bd!#", {noremap = true}) +map("n", "", ":checkt", {noremap = true}) -- ---------------------------------------- -- PACKER -- ---------------------------------------- -local install_path = vim.fn.stdpath("data").."/site/pack/packer/start/packer.nvim" +local install_path = vim.fn.stdpath("data") .. + "/site/pack/packer/start/packer.nvim" if vim.fn.empty(vim.fn.glob(install_path)) > 0 then - vim.fn.system({"git", "clone", "https://github.com/wbthomason/packer.nvim", install_path}) - vim.api.nvim_command "packadd packer.nvim" + vim.fn.system({ + "git", "clone", "https://github.com/wbthomason/packer.nvim", + install_path + }) + vim.api.nvim_command "packadd packer.nvim" end -require("packer").startup {function(use) - use {"wbthomason/packer.nvim"} +require("packer").startup { + function(use) + use {"wbthomason/packer.nvim"} - -- tpope - use {"tpope/vim-sensible"} -- sensible default - use {"tpope/vim-commentary"} -- comment out stuff - use {"tpope/vim-surround"} - use {"tpope/vim-repeat"} -- repeat vim-surround with . - use {"tpope/vim-eunuch"} -- Move, Rename etc - use {"farmergreg/vim-lastplace"} -- keep location upon reopening + -- tpope + use {"tpope/vim-sensible"} -- sensible default + use {"tpope/vim-commentary"} -- comment out stuff + use {"tpope/vim-surround"} + use {"tpope/vim-repeat"} -- repeat vim-surround with . + use {"tpope/vim-eunuch"} -- Move, Rename etc + use {"farmergreg/vim-lastplace"} -- keep location upon reopening - -- smooth scrolling - -- use {"psliwka/vim-smoothie"} + -- smooth scrolling + -- use {"psliwka/vim-smoothie"} - -- tables - use {"dhruvasagar/vim-table-mode"} + -- tables + use {"dhruvasagar/vim-table-mode"} - -- git - use {"tpope/vim-fugitive", - config = function() - local map = vim.api.nvim_set_keymap - map("", "", ":vertical Git:vertical resize 60", {}) - map("", "gg", ":vertical Gclog!", {}) - map("", "gc", ":vertical 0Gclog!", {}) - end - } + -- git + use { + "tpope/vim-fugitive", + config = function() + local map = vim.api.nvim_set_keymap + map("", "", ":vertical Git:vertical resize 60", {}) + map("", "gg", ":vertical Gclog!", {}) + map("", "gc", ":vertical 0Gclog!", {}) + end + } - use { - "lewis6991/gitsigns.nvim", - requires = {"nvim-lua/plenary.nvim"}, - config = function() - require("gitsigns").setup{ - numhl = false, - linehl = false, - keymaps = { - -- Default keymap options - noremap = true, - buffer = true, + use { + "lewis6991/gitsigns.nvim", + requires = {"nvim-lua/plenary.nvim"}, + config = function() + require("gitsigns").setup { + numhl = false, + linehl = false, + keymaps = { + -- Default keymap options + noremap = true, + buffer = true, - ["n "] = { expr = true, [[&diff ? "]c" : "lua require('gitsigns.actions').next_hunk()"]]}, - ["n "] = { expr = true, [[&diff ? "[c" : "lua require('gitsigns.actions').prev_hunk()"]]}, + ["n "] = { + expr = true, + [[&diff ? "]c" : "lua require('gitsigns.actions').next_hunk()"]] + }, + ["n "] = { + expr = true, + [[&diff ? "[c" : "lua require('gitsigns.actions').prev_hunk()"]] + }, - ["n gs"] = [[lua require("gitsigns").stage_hunk()]], - ["v gs"] = [[lua require("gitsigns").stage_hunk({vim.fn.line("."), vim.fn.line("v")})]], - ["n gu"] = [[lua require("gitsigns").undo_stage_hunk()]], - ["n gx"] = [[lua require("gitsigns").reset_hunk()]], - ["v gx"] = [[lua require("gitsigns").reset_hunk({vim.fn.line("."), vim.fn.line("v")})]], - ["n gi"] = [[lua require("gitsigns").preview_hunk()]], - ["n gb"] = [[lua require("gitsigns").blame_line(true)]], + ["n gs"] = [[lua require("gitsigns").stage_hunk()]], + ["v gs"] = [[lua require("gitsigns").stage_hunk({vim.fn.line("."), vim.fn.line("v")})]], + ["n gu"] = [[lua require("gitsigns").undo_stage_hunk()]], + ["n gx"] = [[lua require("gitsigns").reset_hunk()]], + ["v gx"] = [[lua require("gitsigns").reset_hunk({vim.fn.line("."), vim.fn.line("v")})]], + ["n gi"] = [[lua require("gitsigns").preview_hunk()]], + ["n gb"] = [[lua require("gitsigns").blame_line(true)]], - -- Text objects - ["o ih"] = [[:lua require("gitsigns.actions").select_hunk()]], - ["x ih"] = [[:lua require("gitsigns.actions").select_hunk()]] - }, - word_diff = false, - } - end - } + -- Text objects + ["o ih"] = [[:lua require("gitsigns.actions").select_hunk()]], + ["x ih"] = [[:lua require("gitsigns.actions").select_hunk()]] + }, + word_diff = false + } + end + } - -- folder tree - use {"kyazdani42/nvim-tree.lua", - requires = {"kyazdani42/nvim-web-devicons"}, - config = function() - require("nvim-tree").setup{ - disable_netrw = false, - auto_close=true, - } - local map = vim.api.nvim_set_keymap - map("n", "", ":NvimTreeToggle", {noremap = true}) - end - } + -- folder tree + use { + "kyazdani42/nvim-tree.lua", + requires = {"kyazdani42/nvim-web-devicons"}, + config = function() + require("nvim-tree").setup { + disable_netrw = false, + auto_close = true + } + local map = vim.api.nvim_set_keymap + map("n", "", ":NvimTreeToggle", {noremap = true}) + end + } - -- theme - use {"folke/tokyonight.nvim", - config = function() - vim.g.tokyonight_style = "night" - end - } + -- theme + use { + "folke/tokyonight.nvim", + config = function() vim.g.tokyonight_style = "night" end + } - use {"sonph/onehalf", rtp = "vim", } - use {"tomasr/molokai", } - use {"morhetz/gruvbox", } - use {"jnurmine/Zenburn", } - use {"nanotech/jellybeans.vim", } - use {"mhartington/oceanic-next", } - use {"NLKNguyen/papercolor-theme", } - use {"drewtempelmeyer/palenight.vim", } - use {"altercation/vim-colors-solarized", } - use {"rakr/vim-one", - config = function() - vim.g.one_allow_italics = 1 - end - } + use {"sonph/onehalf", rtp = "vim"} + use {"tomasr/molokai"} + use {"morhetz/gruvbox"} + use {"jnurmine/Zenburn"} + use {"nanotech/jellybeans.vim"} + use {"mhartington/oceanic-next"} + use {"NLKNguyen/papercolor-theme"} + use {"drewtempelmeyer/palenight.vim"} + use {"altercation/vim-colors-solarized"} + use { + "rakr/vim-one", + config = function() vim.g.one_allow_italics = 1 end + } - use {"ayu-theme/ayu-vim", - config = function() - -- vim.g.ayucolor = "light" - -- vim.g.ayucolor = "mirage" - vim.g.ayucolor = "dark" - end - } + use { + "ayu-theme/ayu-vim", + config = function() + -- vim.g.ayucolor = "light" + -- vim.g.ayucolor = "mirage" + vim.g.ayucolor = "dark" + end + } - use {"skbolton/embark", - config = function() - vim.g.embark_terminal_italics = 1 - end - } + use { + "skbolton/embark", + config = function() vim.g.embark_terminal_italics = 1 end + } - use {"arcticicestudio/nord-vim", - config = function() - end - } + use {"arcticicestudio/nord-vim", config = function() end} - use {"junegunn/seoul256.vim", - config = function() - vim.g.seoul256_background = 235 - end - } - vim.cmd "colorscheme OceanicNext" + use { + "junegunn/seoul256.vim", + config = function() vim.g.seoul256_background = 235 end + } + vim.cmd "colorscheme OceanicNext" - -- coloring of colornames - use {"rrethy/vim-hexokinase", - run = "cd /home/hjalmarlucius/.local/share/nvim/site/pack/packer/start/vim-hexokinase && make hexokinase", - config = function() - vim.g.Hexokinase_highlighters = {"backgroundfull"} - end - } + -- coloring of colornames + use { + "rrethy/vim-hexokinase", + run = "cd /home/hjalmarlucius/.local/share/nvim/site/pack/packer/start/vim-hexokinase && make hexokinase", + config = function() + vim.g.Hexokinase_highlighters = {"backgroundfull"} + end + } - -- flashing cursor on move - use {"danilamihailov/beacon.nvim", - setup = function() - vim.api.nvim_exec( [[highlight Beacon guibg=white ctermbg=15]], false) - end, - config = function() - vim.g.beacon_size = 40 - vim.g.beacon_minimal_jump = 10 - vim.g.beacon_shrink = 1 - end - } + -- flashing cursor on move + use { + "danilamihailov/beacon.nvim", + setup = function() + vim.api.nvim_exec([[highlight Beacon guibg=white ctermbg=15]], + false) + end, + config = function() + vim.g.beacon_size = 40 + vim.g.beacon_minimal_jump = 10 + vim.g.beacon_shrink = 1 + end + } - -- indentation guides - use {"lukas-reineke/indent-blankline.nvim", - config = function() - vim.g.indent_blankline_char = "|" - vim.g.indent_blankline_use_treesitter = true - end - } + -- indentation guides + use { + "lukas-reineke/indent-blankline.nvim", + config = function() + vim.g.indent_blankline_char = "|" + vim.g.indent_blankline_use_treesitter = true + end + } - use {"haya14busa/vim-asterisk", - config = function() - vim.g["asterisk#keeppos"] = 1 - local map = vim.api.nvim_set_keymap - map("", "*", "(asterisk-z*)", {}) - map("", "#", "(asterisk-z#)", {}) - map("", "g*", "(asterisk-gz*)", {}) - map("", "g#", "(asterisk-gz#)", {}) - end - } + use { + "haya14busa/vim-asterisk", + config = function() + vim.g["asterisk#keeppos"] = 1 + local map = vim.api.nvim_set_keymap + map("", "*", "(asterisk-z*)", {}) + map("", "#", "(asterisk-z#)", {}) + map("", "g*", "(asterisk-gz*)", {}) + map("", "g#", "(asterisk-gz#)", {}) + end + } - use {"christoomey/vim-tmux-navigator", - config = function() - vim.g.tmux_navigator_no_mappings = 1 - vim.g.tmux_navigator_disable_when_zoomed = 1 - local map = vim.api.nvim_set_keymap - opts = { silent = true, noremap = true } - map("n", "", ":TmuxNavigateLeft", opts) - map("n", "", ":TmuxNavigateDown", opts) - map("n", "", ":TmuxNavigateUp", opts) - map("n", "", ":TmuxNavigateRight", opts) - end - } + use { + "christoomey/vim-tmux-navigator", + config = function() + vim.g.tmux_navigator_no_mappings = 1 + vim.g.tmux_navigator_disable_when_zoomed = 1 + local map = vim.api.nvim_set_keymap + opts = {silent = true, noremap = true} + map("n", "", ":TmuxNavigateLeft", opts) + map("n", "", ":TmuxNavigateDown", opts) + map("n", "", ":TmuxNavigateUp", opts) + map("n", "", ":TmuxNavigateRight", opts) + end + } - use {"mbbill/undotree", - config = function() - local map = vim.api.nvim_set_keymap - map("", "", ":UndotreeToggle:UndotreeFocus", { noremap = true }) + use { + "mbbill/undotree", + config = function() + local map = vim.api.nvim_set_keymap + map("", "", ":UndotreeToggle:UndotreeFocus", + {noremap = true}) + end + } + + use { + "iamcco/markdown-preview.nvim", -- requires yarn + run = "cd /home/hjalmarlucius/.local/share/nvim/site/pack/packer/start/markdown-preview && yarn install", + config = function() + vim.g.mkdp_auto_start = 0 -- auto start on moving into + vim.g.mkdp_auto_close = 0 -- auto close on moving away + vim.g.mkdp_open_to_the_world = 0 -- available to others + vim.g.mkdp_open_ip = "" -- use custom IP to open preview page + end + } + + use { + "hoob3rt/lualine.nvim", + requires = {"kyazdani42/nvim-web-devicons"}, + config = function() + require("lualine").setup { + options = {theme = "auto"}, + extensions = {"fugitive"}, + sections = { + lualine_a = {"mode"}, + lualine_b = {"branch"}, + lualine_c = {{"filename", file_status = true, path = 1}}, -- , {"diff", colored=false}, { "diagnostics", sources = {"nvim_lsp"}} + lualine_x = {"filetype"}, + lualine_y = {"progress"}, -- "encoding", "fileformat", + lualine_z = {"location"} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {{"filename", file_status = true, path = 1}}, + lualine_x = {}, + lualine_y = {"progress"}, + lualine_z = {"location"} + } + } + end + } + + use { + "akinsho/nvim-bufferline.lua", + requires = {"kyazdani42/nvim-web-devicons"}, + config = function() + require("bufferline").setup { + options = {diagnostics = "nvim_lsp"} + } + local map = vim.api.nvim_set_keymap + map("n", "", ":BufferLineCyclePrev", + {noremap = true, silent = true}) + map("n", "", ":BufferLineCycleNext", + {noremap = true, silent = true}) + map("n", "", ":BufferLineMovePrev", + {noremap = true, silent = true}) + map("n", "", ":BufferLineMoveNext", + {noremap = true, silent = true}) + end + } + + use { + "numtostr/FTerm.nvim", + config = function() + require("FTerm").setup {} + local map = vim.api.nvim_set_keymap + local opts = {noremap = true, silent = true} + map("n", "", [[lua require("FTerm").toggle()]], + opts) + map("t", "", + [[lua require("FTerm").toggle()]], opts) + end + } + + use {"psf/black", config = function() vim.g.black_fast = 1 end} + + -- treesitter + use { + "nvim-treesitter/nvim-treesitter", + run = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup { + ensure_installed = "all" + } + vim.opt.foldexpr = "nvim_treesitter#foldexpr()" + end + } + + use { + "nvim-telescope/telescope.nvim", + requires = {"nvim-lua/popup.nvim", "nvim-lua/plenary.nvim"}, + config = function() + -- TODO grep with regex + local map = vim.api.nvim_set_keymap + local opts = {noremap = true} + local actions = require("telescope.actions") + map("n", "", "Telescope find_files", opts) + map("n", "", "Telescope git_files", opts) + map("n", "", "Telescope live_grep", opts) + map("n", "", "Telescope grep_string", opts) + map("n", "", "Telescope buffers", opts) + map("n", "", "Telescope filetypes", opts) + map("n", "", "Telescope colorscheme", opts) + map("n", "la", "Telescope lsp_code_actions", + opts) + map("v", "la", + "Telescope lsp_range_code_actions", opts) + map("n", "ld", + "Telescope lsp_document_diagnostics", opts) + map("n", "lD", + "Telescope lsp_workspace_diagnostics", opts) + map("n", "", "Telescope", opts) + require("telescope").setup { + defaults = { + vimgrep_arguments = { + "rg", "--color=never", "--no-heading", + -- "--with-filename", + "--line-number", "--column", "--smart-case" + }, + mappings = { + i = { + [""] = actions.close, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.preview_scrolling_up, + [""] = actions.preview_scrolling_down, + [""] = actions.select_default + + actions.center, + [""] = actions.select_horizontal, + [""] = actions.select_vertical, + [""] = actions.select_tab, + [""] = actions.toggle_selection + + actions.move_selection_worse, + [""] = actions.toggle_selection + + actions.move_selection_better, + [""] = actions.send_to_qflist + + actions.open_qflist, + [""] = actions.send_selected_to_qflist + + actions.open_qflist, + [""] = actions.complete_tag + } + }, + file_ignore_patterns = {}, + set_env = {["COLORTERM"] = "truecolor"} + } + } + end + } + + -- autocompletion + use { + "hrsh7th/nvim-cmp", + requires = { + {"hrsh7th/cmp-nvim-lsp", after = "nvim-cmp"}, + {"hrsh7th/cmp-path", after = "nvim-cmp"}, + {"hrsh7th/cmp-buffer", after = "nvim-cmp"}, + {"hrsh7th/cmp-calc", after = "nvim-cmp"} + }, + config = function() + local cmp = require("cmp") + cmp.setup({ + mapping = { + [''] = cmp.mapping.select_next_item({ + behavior = cmp.SelectBehavior.Insert + }), + [''] = cmp.mapping.select_prev_item({ + behavior = cmp.SelectBehavior.Insert + }), + [''] = cmp.mapping.select_next_item({ + behavior = cmp.SelectBehavior.Insert + }), + [''] = cmp.mapping.select_prev_item({ + behavior = cmp.SelectBehavior.Insert + }), + [''] = cmp.mapping.select_next_item({ + behavior = cmp.SelectBehavior.Select + }), + [''] = cmp.mapping.select_prev_item({ + behavior = cmp.SelectBehavior.Select + }), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true + }) + }, + sources = { + {name = "nvim_lsp"}, {name = "buffer"} + -- { name = "path" }, + -- { name = "nvim_lua" }, + }, + sorting = { + comparators = { + cmp.config.compare.exact, cmp.config.compare.offset, + cmp.config.compare.score, + cmp.config.compare.sort_text, + cmp.config.compare.kind, cmp.config.compare.length, + cmp.config.compare.order + } + } + }) + end + } + + use { + "folke/trouble.nvim", + requires = "kyazdani42/nvim-web-devicons", + config = function() + require("trouble").setup { + position = "right", -- position of the list can be: bottom, top, left, right + height = 10, -- height of the trouble list when position is top or bottom + width = 60, -- width of the list when position is left or right + icons = true, -- use devicons for filenames + mode = "quickfix", -- "lsp_workspace_diagnostics", "lsp_document_diagnostics", "quickfix", "lsp_references", "loclist" + fold_open = "", -- icon used for open folds + fold_closed = "", -- icon used for closed folds + action_keys = { -- key mappings for actions in the trouble list + close = "q", -- close the list + cancel = "", -- cancel the preview and get back to your last window / buffer / cursor + refresh = "r", -- manually refresh + jump = {"", ""}, -- jump to the diagnostic or open / close folds + open_split = {""}, -- open buffer in new split + open_vsplit = {""}, -- open buffer in new vsplit + open_tab = {""}, -- open buffer in new tab + jump_close = {"o"}, -- jump to the diagnostic and close the list + toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode + toggle_preview = "P", -- toggle auto_preview + hover = "K", -- opens a small popup with the full multiline message + preview = "p", -- preview the diagnostic location + close_folds = {"zM", "zm"}, -- close all folds + open_folds = {"zR", "zr"}, -- open all folds + toggle_fold = {"zA", "za"}, -- toggle fold of current file + previous = "k", -- preview item + next = "j" -- next item + }, + indent_lines = true, -- add an indent guide below the fold icons + auto_open = false, -- automatically open the list when you have diagnostics + auto_close = false, -- automatically close the list when you have no diagnostics + auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window + auto_fold = false -- automatically fold a file trouble list at creation + } + local map = vim.api.nvim_set_keymap + local opts = {noremap = true} + map("n", "", ":Trouble lsp_workspace_diagnostics", opts) + map("n", "", ":Trouble quickfix", opts) + map("n", "", ":Trouble loclist", opts) + map("n", "", ":Trouble lsp_references", opts) + end + } + + use { + "folke/todo-comments.nvim", + requires = {"nvim-lua/plenary.nvim"}, + config = function() + require("todo-comments").setup { + signs = true, -- show icons in the signs column + sign_priority = 8, -- sign priority + -- keywords recognized as todo comments + keywords = { + ERROR = {icon = " ", color = "error"}, + WIP = {icon = " ", color = "warning"}, + TODO = {icon = " ", color = "warning"}, + PERF = {icon = " ", color = "info"}, + TEST = {icon = " ", color = "info"}, + MAYBE = {icon = " ", color = "default"}, + IDEA = {icon = " ", color = "hint"} + }, + merge_keywords = true, -- when true, custom keywords will be merged with the defaults + highlight = {keyword = "bg", pattern = [[<(KEYWORDS)\s*]]}, + search = {pattern = [[\b(KEYWORDS)\b]]}, + colors = { + error = {"#E15030"}, + warning = {"#FBBF24"}, + info = {"#91BED0"}, + hint = {"#10B981"}, + default = {"#91D0C1"} + } + } + local map = vim.api.nvim_set_keymap + local opts = {noremap = true} + map("n", "", ":TodoTrouble", opts) + end + } + + use { + "neovim/nvim-lspconfig", + run = ":TSUpdate", + config = function() + -- see https://github.com/lukas-reineke/dotfiles/blob/master/vim/lua/lsp/init.lua + on_attach = function(client, bufnr) + local bmap = vim.api.nvim_buf_set_keymap + local opts = {noremap = true} + vim.api.nvim_buf_set_option(bufnr, "omnifunc", + "v:lua.vim.lsp.omnifunc") + vim.lsp.set_log_level("error") + -- workspaces + bmap(bufnr, "n", "wa", + "lua vim.lsp.buf.add_workspace_folder()", opts) + bmap(bufnr, "n", "wr", + "lua vim.lsp.buf.remove_workspace_folder()", + opts) + bmap(bufnr, "n", "wl", + "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", + opts) + -- jump + bmap(bufnr, "n", "gl", + "lua vim.lsp.diagnostic.set_loclist({severity_limit='Warning'})", + opts) + bmap(bufnr, "n", "", + "lua vim.lsp.diagnostic.show_line_diagnostics({show_header=false})", + opts) + bmap(bufnr, "n", "", + "lua vim.lsp.diagnostic.goto_next({severity_limit='Warning', popup_opts={show_header=false}})", + opts) + bmap(bufnr, "n", "", + "lua vim.lsp.diagnostic.goto_prev({severity_limit='Warning', popup_opts={show_header=false}})", + opts) + -- popups + bmap(bufnr, "n", "", + "lua vim.lsp.buf.signature_help()", opts) + bmap(bufnr, "i", "", + "lua vim.lsp.buf.signature_help()", opts) + -- other + if client.resolved_capabilities.goto_definition then + bmap(bufnr, "n", "gd", + ":lua vim.lsp.buf.definition()", opts) + end + if client.resolved_capabilities.find_references then + bmap(bufnr, "n", "gr", + "lua vim.lsp.buf.references()", opts) + end + if client.resolved_capabilities.hover then + bmap(bufnr, "n", "K", + "lua vim.lsp.buf.hover()", opts) + end + if client.resolved_capabilities.rename then + bmap(bufnr, "n", "", + "lua vim.lsp.buf.rename()", opts) + end + if client.resolved_capabilities.document_formatting or + client.resolved_capabilities.document_range_formatting then + vim.api.nvim_command [[augroup Format]] + vim.api.nvim_command [[autocmd! * ]] + vim.api + .nvim_command [[autocmd BufWritePost *.py lua vim.lsp.buf.formatting_seq_sync()]] + vim.api + .nvim_command [[autocmd BufWritePost *.lua lua vim.lsp.buf.formatting_seq_sync()]] + vim.api + .nvim_command [[autocmd BufWritePost *.md lua vim.lsp.buf.formatting_seq_sync()]] + vim.api + .nvim_command [[autocmd BufWritePost *.yaml lua vim.lsp.buf.formatting_seq_sync()]] + vim.api.nvim_command [[augroup END]] + + end + end + local nvim_lsp = require("lspconfig") + nvim_lsp.tsserver.setup {} + nvim_lsp.yamlls.setup { + on_attach = on_attach, + settings = { + yaml = { + customTags = { + "!ChildContainer mapping", + "!ChildClassVar mapping", + "!ConstantTensorClassVar mapping", + "!ConstantClassVar mapping", "!Dtype scalar", + "!DtypeTensor scalar", "!ImportClass scalar", + "!SeriesTensor mapping", + "!ReferenceContainer mapping", + "!ReferenceLink mapping", + "!SeriesTensorClassVar mapping", + "!UDFfactory scalar", "!UDFnu scalar", + "!UDFvalidator scalar", "!Unit scalar", + "!UserClass mapping", "!UserInstance mapping", + "!getattr mapping" + } + } + } + } + nvim_lsp.pyright.setup { + on_attach = on_attach, + settings = { + python = { + analysis = { + diagnosticMode = "workspace", + logLevel = "Warning", + typeCheckingMode = "basic" + } + } + } + } + local prettier = { + formatCommand = ([[prettier ${--config-precedence:configPrecedence} ${--tab-width:tabWidth} ${--single-quote:singleQuote} ${--trailing-comma:trailingComma}]]) + } + nvim_lsp.efm.setup { + on_attach = on_attach, + init_options = {documentFormatting = true}, + filetypes = { + "python", "markdown", "yaml", "lua", "javascript" + }, + root_dir = vim.loop.cwd, + settings = { + rootMarkers = {".git/"}, + languages = { + python = { + { + lintCommand = "flake8 --max-line-length 88 --format '%(path)s:%(row)d:%(col)d: %(code)s %(code)s %(text)s' --stdin-display-name ${INPUT} -", + lintFormats = {"%f:%l:%c: %t%n%n%n %m"}, + lintSource = "flake8", + lintStdin = true, + lintIgnoreExitCode = true + }, { + formatCommand = "isort --stdout --profile black --force-single-line-imports -", + formatStdin = true + -- }, { + -- lintCommand = "mypy --show-column-numbers --ignore-missing-imports", + -- lintFormats = { + -- "%f=%l:%c: %trror: %m", + -- "%f=%l:%c: %tarning: %m", + -- "%f=%l:%c: %tote: %m" + -- } + } + }, + javascript = {prettier, eslint}, + yaml = {prettier}, + markdown = {prettier}, + lua = { + { + formatCommand = "lua-format -i", + formatStdin = true + } + } + } + } + + } + end + } end -} - - use {"iamcco/markdown-preview.nvim", -- requires yarn - run = "cd /home/hjalmarlucius/.local/share/nvim/site/pack/packer/start/markdown-preview && yarn install", - config = function() - vim.g.mkdp_auto_start = 0 -- auto start on moving into - vim.g.mkdp_auto_close = 0 -- auto close on moving away - vim.g.mkdp_open_to_the_world = 0 -- available to others - vim.g.mkdp_open_ip = "" -- use custom IP to open preview page - end - } - - use {"hoob3rt/lualine.nvim", - requires = {"kyazdani42/nvim-web-devicons"}, - config = function() - require("lualine").setup { - options = { - theme = "auto", - }, - extensions = { - "fugitive", - }, - sections = { - lualine_a = {"mode"}, - lualine_b = {"branch"}, - lualine_c = {{"filename", file_status = true, path = 1}, {"diff", colored=false}, { "diagnostics", sources = {"nvim_lsp"}}}, - lualine_x = {"encoding", "fileformat", "filetype"}, - lualine_y = {"progress"}, - lualine_z = {"location"} - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {{"filename", file_status = true, path = 1}}, - lualine_x = {"location"}, - lualine_y = {"progress"}, - lualine_z = {} - }, - } - end - } - - use {"akinsho/nvim-bufferline.lua", - requires = {"kyazdani42/nvim-web-devicons"}, - config = function() - require("bufferline").setup{ - options = { - diagnostics = "nvim_lsp", - } - } - local map = vim.api.nvim_set_keymap - map("n", "", ":BufferLineCyclePrev", { noremap = true, silent=true }) - map("n", "", ":BufferLineCycleNext", { noremap = true, silent=true }) - map("n", "", ":BufferLineMovePrev", { noremap = true, silent=true }) - map("n", "", ":BufferLineMoveNext", { noremap = true, silent=true }) - end - } - - use {"numtostr/FTerm.nvim", - config = function() - require("FTerm").setup{} - local map = vim.api.nvim_set_keymap - local opts = { noremap = true, silent = true } - map("n", "", [[lua require("FTerm").toggle()]], opts) - map("t", "", [[lua require("FTerm").toggle()]], opts) - end - } - - use {"psf/black", - config = function() - vim.g.black_fast = 1 - end - } - --- treesitter -use {"nvim-treesitter/nvim-treesitter", - run = ":TSUpdate", - config = function() - require("nvim-treesitter.configs").setup { - ensure_installed = "all", - } - vim.opt.foldexpr = "nvim_treesitter#foldexpr()" - end - } - - use {"nvim-telescope/telescope.nvim", - requires = {"nvim-lua/popup.nvim", "nvim-lua/plenary.nvim"}, - config = function() - -- TODO grep with regex - local map = vim.api.nvim_set_keymap - local opts = { noremap = true } - local actions = require("telescope.actions") - map("n", "", "Telescope find_files", opts ) - map("n", "", "Telescope git_files", opts ) - map("n", "", "Telescope live_grep", opts ) - map("n", "", "Telescope grep_string", opts ) - map("n", "", "Telescope buffers", opts ) - map("n", "", "Telescope filetypes", opts ) - map("n", "", "Telescope colorscheme", opts ) - map("n", "la", "Telescope lsp_code_actions", opts ) - map("v", "la", "Telescope lsp_range_code_actions", opts ) - map("n", "ld", "Telescope lsp_document_diagnostics", opts ) - map("n", "lD", "Telescope lsp_workspace_diagnostics", opts ) - map("n", "", "Telescope", opts ) - require("telescope").setup{ - defaults = { - vimgrep_arguments = { - "rg", - "--color=never", - "--no-heading", - -- "--with-filename", - "--line-number", - "--column", - "--smart-case" - }, - mappings = { - i = { - [""] = actions.close, - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - [""] = actions.select_default + actions.center, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - [""] = actions.complete_tag - }, - }, - file_ignore_patterns = {}, - set_env = { ["COLORTERM"] = "truecolor" }, - }, - } - end } - - -- autocompletion - use {"hrsh7th/nvim-cmp", - requires = { - { "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" }, - { "hrsh7th/cmp-path", after = "nvim-cmp" }, - { "hrsh7th/cmp-buffer", after = "nvim-cmp" }, - { "hrsh7th/cmp-calc", after = "nvim-cmp" }, - }, - config = function() - local cmp = require("cmp") - cmp.setup({ - mapping = { - [''] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [''] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [''] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), - [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true, }) - }, - sources = { - { name = "nvim_lsp" }, - { name = "buffer" }, - -- { name = "path" }, - -- { name = "nvim_lua" }, - }, - sorting = { - comparators = { - cmp.config.compare.exact, - cmp.config.compare.offset, - cmp.config.compare.score, - cmp.config.compare.sort_text, - cmp.config.compare.kind, - cmp.config.compare.length, - cmp.config.compare.order, - } - }, - }) - end - } - - use { - "folke/trouble.nvim", - requires = "kyazdani42/nvim-web-devicons", - config = function() - require("trouble").setup { - position = "right", -- position of the list can be: bottom, top, left, right - height = 10, -- height of the trouble list when position is top or bottom - width = 60, -- width of the list when position is left or right - icons = true, -- use devicons for filenames - mode = "quickfix", -- "lsp_workspace_diagnostics", "lsp_document_diagnostics", "quickfix", "lsp_references", "loclist" - fold_open = "", -- icon used for open folds - fold_closed = "", -- icon used for closed folds - action_keys = { -- key mappings for actions in the trouble list - close = "q", -- close the list - cancel = "", -- cancel the preview and get back to your last window / buffer / cursor - refresh = "r", -- manually refresh - jump = {"", ""}, -- jump to the diagnostic or open / close folds - open_split = { "" }, -- open buffer in new split - open_vsplit = { "" }, -- open buffer in new vsplit - open_tab = { "" }, -- open buffer in new tab - jump_close = {"o"}, -- jump to the diagnostic and close the list - toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode - toggle_preview = "P", -- toggle auto_preview - hover = "K", -- opens a small popup with the full multiline message - preview = "p", -- preview the diagnostic location - close_folds = {"zM", "zm"}, -- close all folds - open_folds = {"zR", "zr"}, -- open all folds - toggle_fold = {"zA", "za"}, -- toggle fold of current file - previous = "k", -- preview item - next = "j" -- next item - }, - indent_lines = true, -- add an indent guide below the fold icons - auto_open = false, -- automatically open the list when you have diagnostics - auto_close = false, -- automatically close the list when you have no diagnostics - auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window - auto_fold = false, -- automatically fold a file trouble list at creation - } - local map = vim.api.nvim_set_keymap - local opts = { noremap = true } - map("n", "", ":Trouble lsp_workspace_diagnostics", opts) - map("n", "", ":Trouble quickfix", opts) - map("n", "", ":Trouble loclist", opts) - map("n", "", ":Trouble lsp_references", opts) - end - } - - use {"folke/todo-comments.nvim", - requires = {"nvim-lua/plenary.nvim"}, - config = function() - require("todo-comments").setup { - signs = true, -- show icons in the signs column - sign_priority = 8, -- sign priority - -- keywords recognized as todo comments - keywords = { - ERROR = { icon = " ", color = "error" }, - WIP = { icon = " ", color = "warning" }, - TODO = { icon = " ", color = "warning" }, - PERF = { icon = " ", color = "info" }, - TEST = { icon = " ", color = "info" }, - MAYBE = { icon = " ", color = "default" }, - IDEA = { icon = " ", color = "hint" }, - }, - merge_keywords = true, -- when true, custom keywords will be merged with the defaults - highlight = { keyword = "bg", pattern = [[<(KEYWORDS)\s*]], }, - search = { pattern = [[\b(KEYWORDS)\b]], }, - colors = { - error = { "#E15030" }, - warning = { "#FBBF24" }, - info = { "#91BED0" }, - hint = { "#10B981" }, - default = { "#91D0C1" }, - }, - } - local map = vim.api.nvim_set_keymap - local opts = { noremap = true } - map("n", "", ":TodoTrouble", opts) - end - } - - use {"neovim/nvim-lspconfig", - run = ":TSUpdate", - config = function() - -- see https://github.com/lukas-reineke/dotfiles/blob/master/vim/lua/lsp/init.lua - on_attach = function (client, bufnr) - local bmap = vim.api.nvim_buf_set_keymap - local opts = { noremap = true } - vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") - vim.lsp.set_log_level("error") - -- workspaces - bmap(bufnr, "n", "wa", "lua vim.lsp.buf.add_workspace_folder()", opts) - bmap(bufnr, "n", "wr", "lua vim.lsp.buf.remove_workspace_folder()", opts) - bmap(bufnr, "n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", opts) - -- jump - bmap(bufnr, "n", "gl", "lua vim.lsp.diagnostic.set_loclist({severity_limit='Warning'})", opts) - bmap(bufnr, "n", "", "lua vim.lsp.diagnostic.show_line_diagnostics({show_header=false})", opts) - bmap(bufnr, "n", "", "lua vim.lsp.diagnostic.goto_next({severity_limit='Warning', popup_opts={show_header=false}})", opts) - bmap(bufnr, "n", "", "lua vim.lsp.diagnostic.goto_prev({severity_limit='Warning', popup_opts={show_header=false}})", opts) - -- popups - bmap(bufnr, "n", "", "lua vim.lsp.buf.signature_help()", opts) - bmap(bufnr, "i", "", "lua vim.lsp.buf.signature_help()", opts) - -- other - if client.resolved_capabilities.goto_definition then - bmap(bufnr, "n", "gd", ":lua vim.lsp.buf.definition()", opts) - end - if client.resolved_capabilities.find_references then - bmap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) - end - if client.resolved_capabilities.hover then - bmap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) - end - if client.resolved_capabilities.rename then - bmap(bufnr, "n", "", "lua vim.lsp.buf.rename()", opts) - end - if client.resolved_capabilities.document_formatting or client.resolved_capabilities.document_range_formatting then - vim.api.nvim_command [[augroup Format]] - vim.api.nvim_command [[autocmd! * ]] - vim.api.nvim_command [[autocmd BufWritePost *.py lua vim.lsp.buf.formatting_seq_sync()]] - vim.api.nvim_command [[autocmd BufWritePost *.md lua vim.lsp.buf.formatting_seq_sync()]] - vim.api.nvim_command [[autocmd BufWritePost *.yaml lua vim.lsp.buf.formatting_seq_sync()]] - vim.api.nvim_command [[augroup END]] - end - end - local nvim_lsp = require("lspconfig") - -- sudo npm install -g typescript typescript-language-server - nvim_lsp.tsserver.setup{} - -- sudo npm install -g yaml-language-server - nvim_lsp.yamlls.setup{ - on_attach = on_attach, - settings = { - yaml = { - customTags = { - "!ChildContainer mapping", - "!ChildClassVar mapping", - "!ConstantTensorClassVar mapping", - "!ConstantClassVar mapping", - "!Dtype scalar", - "!DtypeTensor scalar", - "!ImportClass scalar", - "!SeriesTensor mapping", - "!ReferenceContainer mapping", - "!ReferenceLink mapping", - "!SeriesTensorClassVar mapping", - "!UDFfactory scalar", - "!UDFnu scalar", - "!UDFvalidator scalar", - "!Unit scalar", - "!UserClass mapping", - "!UserInstance mapping", - "!getattr mapping", - } - } - } - } - -- sudo npm install -g pyright - nvim_lsp.pyright.setup{ - on_attach = on_attach, - settings = { - python = { - analysis = { - diagnosticMode = "workspace", - logLevel = "Warning", - typeCheckingMode = "basic", - } - } - } - } - local prettier = { - formatCommand = ([[prettier ${--config-precedence:configPrecedence} ${--tab-width:tabWidth} ${--single-quote:singleQuote} ${--trailing-comma:trailingComma}]]) - } - nvim_lsp.efm.setup{ - on_attach = on_attach, - init_options = { documentFormatting = true }, - filetypes = { "python", "markdown", "yaml", "lua", "javascript" }, - root_dir = vim.loop.cwd, - settings = { - rootMarkers = { ".git/" }, - languages = { - python = { - { - lintCommand = "flake8 --max-line-length 88 --format '%(path)s:%(row)d:%(col)d: %(code)s %(code)s %(text)s' --stdin-display-name ${INPUT} -", - lintFormats = {"%f:%l:%c: %t%n%n%n %m"}, - lintSource = "flake8", - lintStdin = true, - lintIgnoreExitCode = true, - }, - { - formatCommand = "isort --stdout --profile black --force-single-line-imports -", - formatStdin = true - }, - }, - javascript = {prettier, eslint}, - yaml = {prettier}, - markdown = {prettier}, - }, - }, - } - end - } -end }