diff options
| author | 2026-09-10 21:54:47 +0200 | |
|---|---|---|
| committer | 2026-09-10 22:12:44 +0200 | |
| commit | d7f52c9aaee49f62f9e3a2a410ca21eb5e4b1649 (patch) | |
| tree | 2fb372e530bd5d7cffc63fae9aeab89f334ec420 /neovim/.config/nvim/lua/config/keymaps.lua | |
| parent | 7264701a9f94b8fe758599f6c1ce32701189fc41 (diff) | |
| download | dotfiles-d7f52c9aaee49f62f9e3a2a410ca21eb5e4b1649.tar.gz dotfiles-d7f52c9aaee49f62f9e3a2a410ca21eb5e4b1649.tar.bz2 dotfiles-d7f52c9aaee49f62f9e3a2a410ca21eb5e4b1649.zip | |
Add standalone Neovim Lua config
Replace the neovim stow package's symlink into vim/.vim with a real,
independent Lua config: init.lua + lua/config/* (options, keymaps,
autocmds, lazy.nvim bootstrap) + lua/plugins/*.lua (one file per plugin
group).
- Plugin manager: lazy.nvim (self-bootstrapping, no submodule needed).
- Carries over every plugin from the vimrc as-is: vim-airline (+ themes,
tmuxline), vim-janah colorscheme, nerdtree, vim-signify, nerdcommenter,
ale, vim-fugitive, quick-scope, ctrlp.vim, claude-code.nvim, plus
vim-ansible-yaml/vim-terraform gated the same way the vimrc gated them
(executable() checks, now as lazy.nvim `cond` functions).
- Replaces YouCompleteMe + jedi-vim entirely with nvim-lspconfig +
mason.nvim + mason-lspconfig.nvim (ensure_installed: pyright, lua_ls,
bashls, terraformls, yamlls, ts_ls, cssls, html; clangd enabled
directly since it's already on PATH via Xcode CLT) and blink.cmp for
completion (+ friendly-snippets), with blink's LSP capabilities merged
into every server's default config.
- ALE stays as a pure linter/fixer (g:ale_disable_lsp = 1) so it doesn't
duplicate nvim-lspconfig's diagnostics/hover/go-to-definition.
- Ports the vimrc's general settings/functions (options, window-nav
keymaps, arrow-key disabling, StripTrailingWhitespace, AppendModeline,
the git->Git abbreviation) to Lua; drops the w!! sudo-save abbreviation
(vimrc's own comment notes it doesn't work under Neovim) and the
reload-vimrc-on-save autocmd (no clean Lua equivalent).
Vim's own vimrc, ftplugin/python.vim, and plugin installs are completely
untouched and unaffected by this change.
Diffstat (limited to 'neovim/.config/nvim/lua/config/keymaps.lua')
| -rw-r--r-- | neovim/.config/nvim/lua/config/keymaps.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/neovim/.config/nvim/lua/config/keymaps.lua b/neovim/.config/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..f0bfbec --- /dev/null +++ b/neovim/.config/nvim/lua/config/keymaps.lua | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | local map = vim.keymap.set | ||
| 2 | |||
| 3 | -- Switch windows with <C-[direction]> | ||
| 4 | map("n", "<C-j>", "<C-w>j") | ||
| 5 | map("n", "<C-k>", "<C-w>k") | ||
| 6 | map("n", "<C-h>", "<C-w>h") | ||
| 7 | map("n", "<C-l>", "<C-w>l") | ||
| 8 | |||
| 9 | -- Never use the arrow keys | ||
| 10 | for _, key in ipairs({ "<Up>", "<Down>", "<Left>", "<Right>" }) do | ||
| 11 | map({ "n", "i" }, key, "<Nop>") | ||
| 12 | end | ||
| 13 | |||
| 14 | -- Disable ex mode | ||
| 15 | map("n", "Q", "<Nop>") | ||
| 16 | |||
| 17 | -- Expand :git to fugitive's :Git, but only as a whole command. | ||
| 18 | -- (No Lua-native abbreviation API exists, so this stays a thin vim.cmd call.) | ||
| 19 | vim.cmd([[cnoreabbrev <expr> git (getcmdtype() ==# ':' && getcmdline() ==# 'git') ? 'Git' : 'git']]) | ||
| 20 | |||
| 21 | -- Note: the vimrc's `w!!` sudo-save abbreviation is deliberately NOT ported | ||
| 22 | -- here — its own comment says it doesn't work under Neovim (sudo can't | ||
| 23 | -- prompt for a password there). | ||
| 24 | |||
| 25 | -- Append modeline when pressing <leader>ml | ||
| 26 | local function append_modeline() | ||
| 27 | local modeline = string.format( | ||
| 28 | " vim: set ts=%d sw=%d tw=%d %set :", | ||
| 29 | vim.bo.tabstop, | ||
| 30 | vim.bo.shiftwidth, | ||
| 31 | vim.bo.textwidth, | ||
| 32 | vim.bo.expandtab and "" or "no" | ||
| 33 | ) | ||
| 34 | modeline = vim.bo.commentstring:gsub("%%s", modeline) | ||
| 35 | vim.api.nvim_buf_set_lines(0, -1, -1, false, { modeline }) | ||
| 36 | end | ||
| 37 | map("n", "<leader>ml", append_modeline, { silent = true }) | ||
