]> git.madduck.net Git - etc/neovim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

enable LSP, add ALE
authormartin f. krafft <madduck@madduck.net>
Fri, 11 Apr 2025 07:16:38 +0000 (09:16 +0200)
committermartin f. krafft <madduck@madduck.net>
Fri, 11 Apr 2025 18:49:53 +0000 (20:49 +0200)
.config/nvim/init.lua
.config/nvim/keymaps.lua
.config/nvim/plugin/ale.lua [new file with mode: 0644]
.config/nvim/plugin/lspconfig.lua [new file with mode: 0644]
.gitignore.d/neovim

index 705342ebd4a4494fd59ef9c1e6f10782ff407e69..03c40f10437cda74eb556c44e58355cad36dee2b 100644 (file)
@@ -34,6 +34,9 @@ Plug 'Houl/ExplainPattern-vim'
 -- Remember the last editing position
 Plug 'farmergreg/vim-lastplace'
 
+Plug 'neovim/nvim-lspconfig'
+Plug 'dense-analysis/ale'
+
 vim.call "plug#end"
 
 function hasPlug(plugin)
index 46bb87f398714f1608f7828ea774bb8e7fd39245..891ea02c38983fbbc0e3b1be1eba99d8b16e199b 100644 (file)
@@ -6,3 +6,7 @@ vim.keymap.set({'n', 'v', 'o', 'i'}, '<F2>', ':set invpaste<CR>')
 
 -- clear highlights on search when pressing <Esc> in normal mode
 vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
+
+-- Pop-up menu navigation with tab
+vim.keymap.set('i', '<Tab>', function() return vim.fn.pumvisible() and "<C-n>" or "<Tab>" end, {expr = true, remap = false})
+vim.keymap.set('i', '<S-Tab>', function() return vim.fn.pumvisible() and "<C-p>" or "<S-Tab>" end, {expr = true, remap = false})
diff --git a/.config/nvim/plugin/ale.lua b/.config/nvim/plugin/ale.lua
new file mode 100644 (file)
index 0000000..90dcfa9
--- /dev/null
@@ -0,0 +1,22 @@
+ale = prequire("ale")
+
+if ale then
+  vim.keymap.set({'n', 'i'}, '<F7>', [[<cmd>ALELint<CR>]])
+  vim.keymap.set({'n', 'i'}, '<F8>', [[<cmd>ALEFix<CR>]])
+
+  vim.keymap.set('n', '<C-k>', '<Plug>(ale_previous_wrap)')
+  vim.keymap.set('n', '<C-j>', '<Plug>(ale_next_wrap)')
+
+  vim.g.ale_completion_enabled = 0
+  vim.g.ale_echo_msg_format = '%code: %%s [%linter%]'
+  vim.g.ale_fixers = { ['*'] = { "remove_trailing_lines", "trim_whitespace" } }
+  vim.g.ale_virtualtext_cursor = 'current'
+
+  vim.g.ale_lint_on_text_changed = 'normal'
+  vim.g.ale_lint_on_insert_leave = true
+  vim.g.ale_lint_on_enter = true
+
+  vim.opt_local.signcolumn = 'no'
+else
+  print 'ALE is not installed'
+end
diff --git a/.config/nvim/plugin/lspconfig.lua b/.config/nvim/plugin/lspconfig.lua
new file mode 100644 (file)
index 0000000..c7beef5
--- /dev/null
@@ -0,0 +1,7 @@
+lspconfig = prequire('lspconfig')
+
+if lspconfig then
+  lspconfig.pylsp.setup{}
+else
+  print 'lspconfig is not installed'
+end
index f4ff35c97d7cbba1e3883e085c714dc2a82a2f27..d5d9387c94fd95f9dd711fb5ed0283ed2b4d221a 100644 (file)
@@ -4,8 +4,10 @@
 !/.config/nvim/init.lua
 !/.config/nvim/keymaps.lua
 !/.config/nvim/options.lua
+!/.config/nvim/plugin/ale.lua
 !/.config/nvim/plugin/highlight-yank.lua
 !/.config/nvim/plugin/listmode.lua
+!/.config/nvim/plugin/lspconfig.lua
 !/.config/nvim/plugin/vim-artesanal.lua
 !/.config/nvim/plugin/vim-lastplace.lua
 !/.config/nvim/style.vim