The following sections present a list of key-bindings and features which have been included in the present configuration. Although I take my target audience to be academics looking to write papers in LaTeX and take notes in Markdown, I will not attempt to provide resources for learning LaTeX or Markdown. Similarly, if you are looking for the bindings which come default in Vim, then you might check this resource out. I will provide links to associated tutorial videos throughout, omitting mention of the standard Vim commands which have mostly been preserved. For configuration instructions, see the installation instructions in the README.md as well as the (Install Part 1) video on YouTube. If you are looking for information specifically about using Git, you can find a number of resources in the LearningGit.md file that I've included. I will also provide links to further resources for learning Vim below.
NeoVim maintains the same modes, key-bindings, and conventions as Vim and Vi which go back as far as the late 70s. With some some practice, these conventions provide an extremely powerful and efficient way to edit text documents, making up the core functionality which NeoVim has to offer. Learning to use NeoVim is comparable to learning how to touch-type: it will take a concerted effort over a short period of time to get a good foundation from which mastery can slowly be cultivated over the years to come. However, even with just the foundations, NeoVim offers a significant increase in efficiency, well worth the initial investment. See the introduction (Demo Part 1) for related discussion, as well as the following resources for learning to use NeoVim.
- Detailed Guide Nice overview.
- OpenVim Free interactive Vim tutorial.
- VimAdventure Free game to practice basic Vim commands.
- Vim Tutor A guided tour through
vimtutor. - Tutorial Series Short tutorial video series.
- Orienting Remarks Learning Vim is like learning to touch-type.
- Another List By no means the only other list of links for learning Vim.
- Pure Zeal Nor is this the only sermon on the virtues of Vim and its subtleties.
I have not made any changes to the conventions which come standard with NeoVim, as there is no need to reinvent the wheel. Rather, what follows is a minimal number of extensions to the functionality provided by NeoVim.
Which-Key is triggered by the space bar, and will bring up a range of key-bindings with associated names.
Accordingly, I will focus attention on the mappings included in ~/.config/nvim/keys/mappings.vim, though I will mention some of the Which-Key bindings in discussing plugins in the following section.
- Drag Lines: the commands
alt+jandalt+kwill drag the selected lines up or down in visual, normal, or insert mode, where indenting is adjusted automatically. - Better Indenting: the
<and>keys will adjust indents in both normal and visual mode. - Display Line Movements: in either normal or visual mode,
shift+jandshift+kwill vertically navigate displayed lines as opposed to numbered lines, whereasshift+handshift+lwill move to the beginning or end of the displayed line, respectively.
- Manage Windows: use
<ctrl+space>cto create a new window, and<ctrl+space>kto kill the current window (make sure that all processes have been ended, for instance by closing NeoVim with<space>q). - Switch Windows: use
<ctrl+space>nand<ctrl+space>pto cycle through open windows. - Switch Buffers: use
<bs>and<shift+tab>to cycle though the open buffers. - Navigate Panes: use
<ctrl>h/j/k/lto switch focus between buffers. - Resize Panes: use
<alt>h/lto horizontally resize the buffer in focus.
Commands (Basic Features)
- Save and Quit: use
<space>wto save buffer, and<space>qto save and quite all buffers. - Copy: use
Yto yank to end of line. - Previous Word: use
Eto go to the end of the previous word. - Comment: in normal mode or visual mode, use
ctrl+\to toggle whether the lines in question are commented out. - Help: use
shift+mto open Help for the word under the cursor, andqto close. - Terminal: use
ctrl+tto toggle the terminal window in NeoVim. - Bib Export: use
<space>abto generate local bibliography from all citations present in the document. - Bib Annotate: use
<space>aato generate a markdown file with annotations from the pdf associated with the citation under the cursor.
Zathura (Linux) (Basic Features)
- Index: use
<space>to toggle the index. - Zoom: use
shift+kandshift+jto zoom in and out, respectively. - Print: use
pto print. - Normal Mode: use
wto remove colouration. - Sync: use
ctrl+[right click]on a line in the pdf once it has been generated by Vimtex in order to highlight the corresponding line in NeoVim. For syncing in the other direction, use<space>vto highlight active line in the pdf.- NOTE: Zathura will have to have been started by the NeoVim instances you are currently using for syncing to work. To reset sync, close Zathura and regenerate the pdf via
<space>bor<space>vif building is complete or already turned on.
- NOTE: Zathura will have to have been started by the NeoVim instances you are currently using for syncing to work. To reset sync, close Zathura and regenerate the pdf via
In what follows, I will discuss a number of key plugins included in ~/.config/nvim/vim-plug/plugins.vim which are of considerable use for writing LaTeX documents.
- Local File Search: use
ctrl+pto search for files being tracked by Git in the current project folder, navigating withctrl+j/k, and opening files withEnter. - Fuzzy File Search: use
<space>ffto fuzzy search through all files in the project folder, navigating withctrl+j/k, and opening files withEnter. - Explorer: use
<space>eto open the file explorer, navigating withj/k, opening and closing directories withh/ladding directories withshift+a, adding files witha, opening files withEnter, or looking up commands with?. - Close Buffer: use
<space>dto close current buffer. - LazyGit: use
<space>ggto open LazyGit, followed by?to see a range of different commands, usingh/j/k/lto navigate. - Branch: use
<space>fbto search through git branches. - CWD: use
<space>auto change the project directory to the directory which contains the current file. - Hunks: use
<space>gjand<space>gkto navigate between changes since last commit. - Blame: use
<space>glto see author responsible for previous change of the line under the cursor.
- Projects: use
<space>msto create a new project,<space>mlto switch to a different project, and<space>mdto delete a project. - Templates: use
<space>tto choose from a variety of templates in the~/.config/nvim/templatesdirectory.- To add new templates, add the relevant file to
~/.config/nvim/templates, customising~/.config/nvim/keys/which-key.vim.
- To add new templates, add the relevant file to
- Select Entry: use
ctrl+jandctrl+kto cycle through the autocomplete menu. - Trigger Completion: continue typing after selecting desired option, or hit
Enter. - Snippet Completion: use
Enterto select highlighted option, andtabto move through fields. - Go To: use
gdto go to the definition of the word under the cursor (if any). - Spelling: use
ctrl+sto search alternatives to misspelled word.
- Autopairs: use open-quote/bracket to create pair, adding a space if padding is desired, followed by the closing quote/bracket.
- Add Surround: in visual select mode use
shift+s, or in normal mode use<space>ss, followed by the desired text object, and then either:q/Qfor single/double LaTeX quotes, respectively.ifor italics,bfor bold,tfor typescript,sfor small-caps,$to create an in-line math environment, open (left) bracket/parentheses/brace for padding, and close (right) bracket/parentheses/brace for no padding.
- Change Surround: in normal mode, use
<space>sfollowed by:cfollowed by the trigger for what you want to change (e.g.,}), and then the trigger for what you want to change to (e.g.,[).dfollowed by the trigger for what you want to delete (e.g.,iif the cursor is anywhere in\textit{example}, and similarly for other triggers).
LaTeX Support (Basic Features)
- Build: use
<space>bto toggle auto-build. - View: use
<space>vto preview current line. - Index: use
<space>ito open the index. - Count: use
<space>cto count words. - Report Errors: use
<space>arto open LaTeX log in horizontal split, and<space>dto close. - Clean: use
<space>acto delete auxiliary LaTeX files. - Glossary: use
<space>agto edit the default glossary template. - Snippets: use
<space>asto edit the snippets file. - Vimtex: use
<space>avto lookup bib entry under the cursor, giving you the option of viewing or editing the bib data, opening the file, etc. - Citation: use
<space>fcto search through the bib file included at the end of your LaTeX document. - Pandoc: use
<space>pto select which file format into which you would like to convert the file open in current buffer.
- Undo: use
<space>uto open the undo tree. - Centre: use
alt-mto centre screen on the cursor. - Highlight: use
Enterto kill the result of search highlights. - Htop: use
<space>ahto open thehtopsystem monitor. - Illuminate: use
<space>aito toggle the illumination of all words matching the word under the cursor. - LSP: use
<space>alto toggle the autocomplete menu. - Symbols: use
<space>apto generate the symbol for the math under the cursor. - Buffers: use
<space>fbto switch between open buffers. - Keymaps: use
<space>fkto search through keymaps. - Registers: use
<space>frto search through registers. - Themes: use
<space>ftto switch between themes. - Yanks: use
<space>fyto paste from past yanks. - List: use
<space>lto choose between commands useful for editing lists in markdown documents.