# aliquote.org

Here are the current Neovim mappings I came to feel comfortable with over time. This is by no means a reference card, and yes I do use the arrow keys for navigating into my buffers. It depends on motion range, though. Another key idea is that I use Tmux everyday and I like to have an unified set of mappings, beside the leader/prefix key. See my blog posts for how I started to use Vim and Neovim.

Note that I only have a dozen of plugins in my start and opt directories, in addition to part of mini.nvim that I adapted to suit my needs better: (This may change in the future but usually I tend to remove plugins rather than add new ones.1 )

• [opt] nvim-treesitter, nvim-treesitter-textobjects, Comment.nvim, nvim-lspconfig, nvim-parinfer, vimtex, fzf-hoogle.vim, nvim-colorizer rust-tools.nvim;
• [start] packer.nvim, fzf.vim, fzf
[2022-10-05]
I changed it all again! Latest setup described here. This means that some keybindings no longer apply to my current config. It’s all in the details but I feel like a minimalist setup and almost zero dependencies are the take away message.

I prefer a minimalist setup these days, and I tend to rely on hand-on solutions for tasks I carry over and over. Many of those custom settings come from briliant Vimers who are acknowledged in my config files. Note that some of those mappings may override existing ones, whether they are somewhat redundant (e.g. s and c) or because I don’t use them at all (e.g., some of the Ctrl, g or z combinations).

My leader is “,"2 and I do not define specific mappings for the localleader in my main config files. It looks like I always misunderstood the role of the localleader, and I decided to book it for my after/ftplugin custom settings.

 Mapping Mode Command Role c : Go to start of line c : Go to end of line - n :Ex Show explorer ,! n :10sp +te Popup terminal ,. n :lcd %:p:h Set local current directory ,x n :bp bd! # Kill current buffer ,X n Only() Keep only current buffer (custom) ,e n :e =expand("%:p:h") . "/" Open file from current directory n :tabnext Next tab , n :$tabnew New tab , n C-wT Move split to new tab J n mzJz Join lines (cursor stationary) n quickfix_toggle() Close quickfix window (custom) [Q n :cfirst Go to first quickfix item ]Q n :clast Go to last quickfix item W!! c :w !sudo tee % >/dev/null:e! Save as root i u[s1z=]au Fix last spelling error (repeat.) ,S n vip:sort iu Sort in reverse lexicographic order ,S v :sort u Sort in reverse lexicographic order ,s n vip:sort u Sort in lexicographic order ,s v :sort u Sort in lexicographic order N n Nzz Keep cursor centered on screen when looking behind n n nzz Keep cursor centered on screen when looking ahead U n Redo zs n 1z= Fix spelling using first suggestion n :nohl Clear search highlights ,df n :setlocal spell!setlocal spell?:setlocal spelllang=fr Toggle spelling on/off (French) ,de n :setlocal spell!setlocal spell?:setlocal spelllang=en Toggle spelling on/off (English) ,p n :set invpaste:set paste? Toggle on/off paste mode n :Files Fuzzy finder for files n :RgCw Fzf Rg on current word or project n :TagsCw Fzf Tags on current word or project ,, n :Buffers Fuzzy finder for buffers ,gg n :GFiles? Git status ,gb n :BCommits Git buffer commit log ,gc n :Commits Git commit log ,r n :History Old files ,ww n vim.diagnostic.setqflist Show diagnostics in quickfix (LSP) [d n vim.diagnostic.goto_prev Go to previous diagnostic (LSP) ]d n vim.diagnostic.goto_next Go to next diagnostic (LSP) ,wd n vim.diagnostic.open_float Show diagnostic in a floating window (LSP) g= n vim.lsp.buf.format Format selection (LSP) z= n,x vim.lsp.buf.code_action Code action (LSP) z! n,x vim.lsp.codelens.run Code lens (LSP) gO n vim.lsp.buf.document_symbol() Show workspace or buffer symbols depending on filetype (LSP) K n vim.lsp.buf.hover Show help for current symbol (LSP) i vim.lsp.buf.signature_help Show signature help (LSP) gd n vim.lsp.buf.definition Show definition (LSP) gr n vim.lsp.buf.references Show references (LSP) gi n vim.lsp.buf.implementation Show references (LSP) zr n vim.lsp.buf.rename Rename symbol (LSP) I also have kind of an universal mapping, gs, which depending on filetype may compile a$\LaTeX\$ document or a C file and show its output, run a Python/Haskell/Lisp/Scheme script and show its output, etc. It is defined in relevant after/ftplugin/*.vim files. Finally, since I never found a good or reliable plugin to send command to a terminal, and I’ve tried many of the exiting ones for Vim or Neovim, I wrote my own commands: (It assumes that you have a terminal opened next to your buffer in a split, which is how I work in any case.)

" poor man send-to-repl features (we need to fire a REPL in a split first)
noremap ss Vy<C-w>wpa<CR><C-\><C-n><C-w>pj
noremap s y<C-w>wpa<CR><C-\><C-n><C-w>p
xnoremap s y<C-w>wpa<CR><C-\><C-n><C-w>p


1. When I first drafted this cheatsheet, I was still using 15 plugins or so. Some packages broke at some point and I was too lazy to investigate why, or some were of too little use to justify keeping them. I don’t really miss anything with my current config, though. ↩︎

2. I recently switched to this leader key after having spent three years using the Space key as my leader, as a leftover of my Doom Emacs period. ↩︎