vim
Table of Contents
Reading material
- https://vim.fandom.com/wiki/Search_across_multiple_lines
- https://vimhelp.org/
- https://sanctum.geek.nz/arabesque/advanced-vim-macros/
- https://vim.fandom.com/wiki/Copy,_cut_and_paste
- 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:
- jump between splits using letters - is there a plugin for it?
- How to re-arrange split windows in Vim?
- vimrc shortcut for finding and displaying all the occurences of a word
- in a file
- in a project
- 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.
- Open question - how to do file comparison using Vim?
- 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?
- 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.
- How to use folding in Vim?
- To minimise the method/function implementation. (-) - minus? need a working example.
- VimConf videos in youtube.
- How to make a presentation in Vim?
Answers:
- In nerdtree, how to open a document in a vertical split? Using the letter ’s'.
- 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?
- 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
- vim - buffers, tabs, splits and windows
- vim - sample vimrc configurations for reference
- vim - deleting
- vim - ex commands
- vim - file comparison
- vim - help system
- vim - java development
- vim - installation and configuration
- vim - line numbers
- vim - lists
- vim - macros
- vim - marks and motions
- vim - movement within a file
- vim - netrw
- vim - search
- vim - spelling
- vim - tags
- vim - terminal
- vim - text manipulation
- vim - thoughts on spacevim
- vim - vim and git