vim

Reading material

  1. https://vim.fandom.com/wiki/Search_across_multiple_lines
  2. https://vimhelp.org/
  3. https://sanctum.geek.nz/arabesque/advanced-vim-macros/
  4. https://vim.fandom.com/wiki/Copy,_cut_and_paste
  5. https://vim.fandom.com/wiki/Power_of_g

Key mappings and abbreviations

command description
:map c e↵ map c ↦ e in normal & visual mode
:map! c e↵ map c ↦ e in insert & cmd-line mode
:unmap c↵ :unmap! c↵ remove mapping c
:mk f↵ write current mappings, settings… to file f
:ab c e↵ add abbreviation for c ↦ e
:ab c↵ show abbreviations starting with c
:una c↵ remove abbreviation c

Miscellaneous

command description
:sh↵ :!c↵ start shell, execute command c in shell
K lookup keyword under cursor with man
:make↵ start make, read errors and jump to first
:cn↵ :cp↵ display the next, previous error
:cl↵ :cf↵ list all errors, read errors from file
^L ^G redraw screen, show filename and position
g^G show cursor column, line, and character position
ga show ASCII value of character under cursor
gf open file which filename is under cursor
:redir>f↵ redirect output to file f
:mkview [f] save view configuration [to file f]
:loadview [f] load view configuration [from file f]
^@ ^K ^_ \ Fn ^Fn unmapped keys

Figure out how to do these things in Vim

Questions:

  1. jump between splits using letters - is there a plugin for it?
  2. How to re-arrange split windows in Vim?
  3. vimrc shortcut for finding and displaying all the occurences of a word
    1. in a file
    2. in a project
  4. Using fzf: Search for a word in the entire project and do a quick look-up of all the occurances of the word in the project. Search for a file in fzf by name and open the file in a vertical split or a new tab.
  5. Open question - how to do file comparison using Vim?
  6. How to navigate Javascript code in Vim? How to make ctags work with javascript code in Vim? How to navigate in and out of function definitions?
  7. Coc vs YouCompleteMe? Installing or compiling YouCompleteMe seems to be a pain (especially, in Linux VDEs provided in to developers in a corporate environment). Any simpler alternative to it would be very preferable.
  8. How to use folding in Vim?
  9. To minimise the method/function implementation. (-) - minus? need a working example.
  10. VimConf videos in youtube.
  11. How to make a presentation in Vim?

Answers:

  1. In nerdtree, how to open a document in a vertical split? Using the letter ’s'.
  2. This can already be done in nerdtree. So, this is not a priority. How to toggle netrw on and off without leaving the current buffer? In other words, show current buffer/file in netrw without leaving current buffer?
  3. This can already be done in nerdtree. So, this is not a priority. When you open a file from a project (Java or any other project) in Vim, and then toggle netrw on, how to make netrw show only the file tree related to the current project and not the file tree for the entire computer?

Tips to improve Vim speed

Look into the following settings in Vim:

  • Don’t allow backspace in insert mode.
  • Disable arrow keys in insert mode.
  • Disable arrow keys in all modes and bind them to “no ops” instead. Just use hjkl movements.

Use the following plugins to help with speed:

  • vim hardmode or vim hardtime
  • vim surround

Tags

  1. vim - buffers, tabs, splits and windows
  2. vim - sample vimrc configurations for reference
  3. vim - deleting
  4. vim - ex commands
  5. vim - file comparison
  6. vim - help system
  7. vim - java development
  8. vim - installation and configuration
  9. vim - line numbers
  10. vim - lists
  11. vim - macros
  12. vim - marks and motions
  13. vim - movement within a file
  14. vim - netrw
  15. vim - search
  16. vim - spelling
  17. vim - tags
  18. vim - terminal
  19. vim - text manipulation
  20. vim - thoughts on spacevim
  21. vim - vim and git