VKO vim configuration

December 3, 2020 ยท View on GitHub

Advanced VIM Configuration for FullStack Developers, for now it's supporting.

  • Backend: Ruby on Rails, Python and Elixir.
  • Front-end: React
  • Ops: Docker, Nginx, Ansible.

Only tested with Neovim.

Mappings

Leaders

keyDescription
<space>Leader
;FuzzyFinder
,Files
sWindows
tTabs
zFoldings
mBookmarks

Miscellaneous

keyModeAction
ReloadCommandReload vimrc
<Leader>aNormalAlign paragraph
<Leader>,NormalRemove all spaces EOL
<Leader>owNormalOverwrite word under cursor
<Leader>sawNormal/visualReplace all occurences under cursor
<Leader>wNormalSave current file
<Leader>dNormal/VisualDuplicate line/selected
<Leader>rpNormalRemove all lines with the given patter
!NormalStart an external Command with a single bang
jkInsertGo to normal mode
<Leader>hAllToogle permanent Highlight for word under cursor
<Leader>yVisualToogle permanent Highlight for selected region
<Leader>xVisualToggle markdown checkbox ([] -> [x] -> [n/a] -> [])
<Leader>vVisualExpand selected region
<Leader>,VisualRemove emtpy speces
svisualReplace within selected area
gpNormalSelect last paste
YNormalCopy until the end of line
qNormalQuit
<ctrl>ovisualJump to last edited location
<ctrl>ivisualJump to next edited location
<Ctrl>rinsertOpen resgister content
gc<motion>Normal/visualToggle comments
/NormalEasy motion between panels
W!!CommandSave with sudo
<Leader>;NormalToggle tag bar
<Leader>x(j/k)NormalCut line by number to the current cursor position
<Leader>c(j/k)NormalCopy line by number to the current cursor position

Macro

keyModeAction
QNormalRecord
MNormalExecute

Windows s

keyModeAction
<Window>vNormalSplit tab horizontaly
<Window>gNormalSplit tab verticaly
<Window>cNormalClose
<Window>coNormalClose other
<Window>bNormalBack to previous buffer
<Window>rNormalRotate
<Window>zNormalZoom toggle
ArrowsNormalResize

Tabs t

keyModeAction
<Tabs>tNormalOpen new tab
<Tabs>lNormalNext tab
<Tabs>hNormalPrev tab

Files ,

keyModeAction
<Files>duNormalDuplicate current file
<Files>deNormalDelete current file
<Files>mNormalMove/Rename current file
<Files>yNormalCopy file-path to clipboard(relative)
<Files>YNormalCopy file-path to clipboard(absolute)
keyModeAction
<Files>eNormalToggle file explorer
<Files>aNormalToggle file explorer on current file
wNerdTreeToggle window size
NNerdTreeCreate new file or directy

FuzzyFinder ;

keyModeAction
<FuzzyFinder>fNormalFiles
<FuzzyFinder>wNormalOpened Windows
<FuzzyFinder>gNormalSearch text all
<FuzzyFinder>tNormalTags
<FuzzyFinder>TNormalTags(Current Buffer)
<FuzzyFinder>cNormalCommits(current file)
<FuzzyFinder>bNormalBuffers
<FuzzyFinder>/NormalLines(current buffer)
<FuzzyFinder>mNormalMarks

Find and Replace(Far)

keyModeAction
:Far <from> <to> <files>CommandOpen "find & replace" console
tFarToggle the match above the cursor
:FardoFarDo the replacement
:F <pattern>Commandfind all

Dash

keyModeAction
<leader>kNormalOpen current word in Dash.app(documentation)

Ctags

keyModeAction
<ctrl>]NormalGo to definition
UpdateTagsCommandUpdateTags

COC

keyModeAction
gdNormalGo to definition
<FuzzyFinder>sySearch for symbols inside current file

Multiple Cursor

keyModeAction
<ctrl>nNormalselect next occurence
<ctrl>pNormalUndo Selection
<ctrl>xNormalSkip current

Bookmarks m

keyModeAction
<Bookmarks>mNormalToggle bookmarks in current line
<Bookmarks>nNormalJump to next bookmark
<Bookmarks>pNormalJump to prev bookmark
<Bookmarks>aNormalshow list of all bookmarks
<Bookmarks>xNormalremove all bookmarks

Foldings z

keyModeAction
<Foldings>aNormaltoggle fold current level
<Foldings>rNormalRecues folding by opening one more level of folds
<Foldings>RNormalOpen all folds
<Foldings>MzaNormalClose the others

Git

keyModeAction

Snippets

keyModeAction
<Leader>sNormalcreate a new snippet

Tabularize

keyModeAction
<Leader>ttNormal/visualtabularize by custom
<Leader>t=Normal/visualtabularize by =
<Leader>t:Normal/visualtabularize by :

Text Objects

keyModeAction
eNormalentire file
_Normalunderscore
rNormalruby block
=/-Normalerb
iNormalindentation level
fNormalfunction

Languages/Frameworks

Ruby

KeyModeAction
,#Normalruby string interpolation #{}
]mNormalTo edit start of next method definition
]MNormalTo go to end of next method definition
[mNormalTo start of previous method definition
[MNormalTo end of previous method definition
<Leader>rapNormalAdd params to method
<Leader>ritNormalRemove declaration of the variable and use the result
<Leader>rcpcNormalFrom if one line to multiline
<Leader>recNormalExtract Constant
<Leader>relNormalExtract let
<Leader>relvNormalTo local variable
<Leader>rrlvNormalRename local variable
<Leader>rrivNormalRename instance variable

Ruby On Rails

keyModeAction
gfNormalgoto
:ACommandAlternate file
:ASCommandAlternate file in split
:RCommandRelated file
:RSCommandRelated file in split
<FuzzyFinder>moNormalSearch for models
<FuzzyFinder>cNormalSearch for controller

Elixir

keyModeAction

Go

keyModeAction

Clojure

keyModeAction

Python

keyModeAction

Javascript

keyModeAction
:ImportJSFixCommandImport any missing modules and remove any modules that are not used
:JsDocCommandGenerate JSDoc for the function

React

keyModeAction

CSS

keyModeAction

HTML/JSX

keyModeAction
Ctrl+y + ,CommandExpand emmet sequence
Ctrl+y + ,visualWrap selected tag with emmet sequence
<c-y>dinsertBalance a Tag Inward
<c-y>DinsertBalance a Tag Outward
<c-y>ninsertGo to the Next Edit Point
<c-y>NinsertGo to the Previous Edit Point

Required

How to install

$ cd ~/.config
$ mv nvim nvim-bk
$ git clone git@github.com:AlexVKO/VimKO.git nvim

And then inside neovim run :PlugInstall

Based by: