Vim settings
I'm always eager to learn, but I can't remember everything. Here is the list of the plugins I'm using - it is a reminder of the most important commands and settings for each plugin.
Installation
$ git clone https://github.com/wikimatze/vimfiles.git ~/.vim && ln -sf ~/.vim/.vimrc ~/.vimrc
Next, start vim and run :PlugInstall
- happy vimming!
Plugins
ale
Asynchronous Lint Engine.
bclose.vim
Need this plugin to close the ranger window with q
.
far.vim
A find and replace plugin.
:Far <word> <replace-with> **/*.<filetype> [params]
... will start the replacement for the given filetype:F* {pattern} {file-mask} [params]
... will just search after the word without the replacement part:Fardo
... will do the replacement:Farundo
... undo the last:Fardo
replacement.:Refar
... do the used replacement again with the chance to change option's:Farp
... will ask questions for interactive replacement- in Far buffer the following shortcuts are active
x|X
... will exclude the/all file(s) under the cursori|I
... will include the/all file(s) under the cursort
... will toggle exclude/include file under the cursor<CR>
... jump to the source of the match<CR-j>|<CR-k>
... scroll down/up the preview window
fzf
Fuzzy finder for your shell as a Vim plugin.
fugitive
Git wrapper.
:Gstatus
... git status<C-n>
... go to the next file<C-p>
... go to the previous file-
... git add/git reset depending where you are in the windows (mark multiple files in visual mode)cc
... make git commitca
... makes git commit ammendD
... makes diffds
... makes a horizontaldv
... makes a vertical diffq
... close :Gstatusp
... rungit add -p
for the current file
:Gwrite
... stage the current file to index:Gcommit
... git commit (press wq for send):Gremove
... git rm:Gmove
... rename the current file and add change to index:Gpush
... performs a git push:Gread
... makes will load the previous file status on the current file buffer:Gdiff
... split the window to see diff]c
... jump to next hunk of the merge[c
... jump to previous hunk of merge:diffget
... get the changes from the not active window:diffput
... put the changes from the active window to the not active window- 3-way diffs:
:diffget //LO
... get the changes from left LOCAL (the file from the current branch):diffget //RE
... get changes from the right REMOTE (the file you are merging into your branch),:diffupdate
... clean up the views when having a file with many conflictsdp
... if you are not in the working copy, you can use this command to put in the changes- when done with merging, run
:Gwrite
and:only!
on the working copy to close all the other windows
:Gblame
... git blameq
... close blame and return to blamed windowo
... opens commit horizontally, leaving blame window open<CR>
... opens commit for currently blame commit, blame window is closed
:Git
... perform every other normal git command in the terminal- searching:
- search working copy files:
:Ggrep <word>
- search commit messages:
:Glog --grep=fugitive
- search for words added or removed:
Glog -Sadd
- search working copy files:
gitv
A gitk/tig like git browser.
:gitv
... opens only gitv:gitv!
... opens only commits which affects the current fileco
... performs a checkout of the commit on the currently focused commityc
... yanks the SHA of the commitq
... quits gitv:Gitv -S<string>
... look for differences that introduce or remove an instance of- custom mappings:
nmap <leader>gv :Gitv --all<cr>
nmap <leader>gV :Gitv! --all<cr>
IndexSearch
Redefines the search (/,?)
and creates custom messages about how many hits there are.
vim-markdown
Perfect managing markdown file.
lexima
Semantic autoclose, delete brackets, ...
neocomplete
Amazing tool for keyword completion.
neosnippet
Adds snippet support for Vim and makes use of neocomplete plugin.
NeoSnippetEdit
... edit snippets of the current filetype
open-browser
Open the URI with gx
(my custom mapping) in your default browser.
ranger.vim
Ranger intergration for vim and neovim.
surround
Change quotes and all other delimiters.
ds"
... stands for delete surround and will delete the surrounds- example:
{ :a => 1 }
after pressingds{
you will get:a => 1
- example:
cs("
... change surroundings and will replace the first surrounding argument with the second surrounding- example:
(:a => 1)
after pressingcs({
you will get{ :a => 1 }
- example:
ys
... "you surround" and the first argument specifies the scope (can be a motion) and the second makes the replacement and the second using for wrapping up the first argument with the quotesys2w
... will wrapp two following words (2w
) with underscores (\*
)yss{
... wraps the whole lineysiw
... yank the inner word and in the command window add the tag you want to add
- how to quote whole string?
- mark the string in visual mode (either normal mode with v or block mode with
V
), then presss
and then the quote ("", (), {}
) you want to have and it wraps the string in this
- mark the string in visual mode (either normal mode with v or block mode with
caw.vim
Vim comment plugin.
gcc
... toogles current linegca
... at comment at end of the line
quick-scope
Lightning fast left-right movement in Vim
tmux-complete-vim
Insert mode completion for neighbor tmux windows.
:Unite tmuxcomplete
... opens a unite menu listing all entries or words from other tmux windows:Unite tmuxcomplete/lines
... opens a unite menu listing all entries or words from other tmux windows with their lines
undotree
Display the undo graph for a file.
:UndotreeToggle
... turn on or off the toggle feature
tagbar
Display the structure of the code.
:TagbarToggle
... opens or close the tagbar whether it was closed or open:TagbarOpen
... open view tagbar:TagbarOpenAutoClose
... opens the tagbar and close it after a tag was selectedx
... will zoom in/out the tagbar windowq
... quit yankring window?
... will print help
vimagit
A new way to use git in Vim.
:Magit
... opens the windowN|P
... jumps to the next/previous hunkS
... stage the current selected hunk- works even in visual mode!
L
... stage the current lineF
... stage/unstage the whole file at cursor positionE
... will open the file inR
... will refresh the magit windowM
... mark the current line for staging and pressS
to chunk all marked filesCC
... prepare for commit and pressingCC
again will make the commitCF
... will append the staged files to the previous commit without changing commit messageCA
... do a amend where you can change the commit messageq
... quit magit
vader.vim
Testframework for Vimscript.
:Vader
... runs the current test file
lightline
Awesome way to create a custom status line.
vim-closetag
Auto close (X)HTML tags. Press <
again will do the intendation.
vim-dispatch
Run commands asynchronous.
vim-endwise
Automatically adds keywords like end to special constructs for all kinds of languages.
vim-grepper
Use grep to find anything.
vim-github-theme
My first light colorscheme for vim.
vim-gnupg
Transparent editing of gpg encrypted files.
vim-gutentags
Updates tags file whenever you save a file.
vim-lexical
Custom dictionary, thesaurus, and spell checking options for files or when calling a command.
<C-x> <C-k>
... opens the dictionary<C-x> <C-t>
... opens the thesaurus<C-n>|<C-p>
... navigate to the next or previous matching- custom commands:
:German|:English
... will load my customized settings
vim-litecorrect
Lightweight auto correction for 300 words.
e.g:
Im -> I'm
shouldnt -> shouldn't
thats -> that's
vim-misc
Extended Vim standard library needed for vim-notes plugin.
vim-move
Move lines and selections up and down.
vim-notes
Perfect note taking.
:Note
... starts a new note (you can specify the name of the note in the header):write or :update
save the notes:RecentNotes
... overview of the last created changes:RelatedNotes
... shows all notes according to actual heading in the note:SearchNotes <pattern>
... search after all notes containing the specified pattern/word:edit note:<name-of-note>
... you can edit notes (other commands::split
,:tabedit
):NoteFromSelectedText
... create a new node from the selected text:DeleteNote
... deletes the actual notelet g:notes_directory = '~/Documents/Notes'
... define the directory where files should be saved- it is possible to open notes directly from the command-line with vim notes:collect
- tags:
- with @tag you can define own tags (they are useful for searching)
:IndexTaggedNotes
... creates new tags (for omnicomplete when @ is pressed):ShowTaggedNotes
... will show all notes which are specified with a certain tag
vim-plug
Package manager for Vim.
:PlugInstall
... installs all the specified:PlugClean
... will remove all not used bundles:PlugUpgrade
... upgrade vim-plug automatically:PlugDiff
... show the latest change commits for your installed plugins
vim-ruby
Configuration files for editing and compiling Ruby - it even adds custom text-objects only for Vim.
- following commands can performed in visual mode
am
... "a method" select from 'def' till 'end'im
... "inner method" select all inside the method exclude 'def' and 'end'aM
... "a class" select from 'class' till 'end'iM
... "inner class" select all inside the class exclude 'class' and 'end'
- the following commands can only performed normal mode
]m
... move to the beginning of the next method[m
... move to the beginning of the previous method]]
... move to the beginning of the next module or class definition[[
... move to the beginning of the previous module or class definition
vim-test
Easy run your test for various programming languages.
:TestNearest
... will only run where cursor location is:TestFile
... will run all tests of the current file:TestLast
... will run the last test again:TestVisit
... jumps to the last executed test
vim-tmux-navigator
Switch seamlessly between tmux panes and Vim splits.
<Ctrl-h>
... Left<Ctrl-j>
... Down<Ctrl-k>
... Up<Ctrl-l>
... Right
vimtex
A very good tool to manage LaTeX files as well as the compilation.
\ll
... compiles the tex-file\lv
... opens the document with the specified pdf-viewer:VimtexTocOpen|:VimtexTocToggle
... will open a clickable toc in the left pane (q
will close the window)
neoyank
Saves yank history includes unite.vim history/yank source.
<leader>y
... call the yank window
denite.vim
Asynchronous unite all interfaces for Neovim/Vim8.
License
This software is licensed under the MIT license.
© Matthias Günther [email protected]