End of this file you find how turn your VIM a real IDE, with navigatoin betwwen class and function.
-
| - goto begin line, b - begin word, e - end word, w - next word, $ - end file
-
A - start insert mode END line
-
I - start insert mode BEGIN of line
-
o - insert new line and change to insert mode
-
S or cc - change line
-
L - move to end of view port
-
v - visual, c - change
-
d - delete
-
y - yank/copy, p - paste, yy - yank line
-
i - inside, a - around, f - find
-
. - repeat last command or sequence
-
f? - find character ?
-
ctrl + v - VISUAL block, useful change more one line in same time. try: ctrl + v after that jjj and choise change mode using c, after change type ESC
-
:{NUMBERLINE} - goto line, gg - begin file, G - end file
-
:r filename - insert content of filename starting in cursor
-
lead is \
-
h - left
-
j - bottom
-
k - top
-
l - rigth
-
Tab+X+ENTER - jump to next X lines
-
H - move to top of screen
-
M - movel middle of screen
-
L - move botton of screen
-
z. - put the line with the cursor at the center
-
zt - put the line with the cursor at the top
-
zb - put the line with the cursor at the bottom of the screen
-
J - remove break line and spaces on begin of line. Useful when remove excessive formatation
- :.,Xd - delete from current line to line X
- diw or daw - delete inside/around word
- db - delete cursor to previous start word, see: d|, d$, de
- dG - delete cursor to end file,
- dgg - delete cursor to begin file
- cis - change inside sentence
- ci" - change inside quote, try move cursor to middle word and type caw - change around word
- c/foo - change from cursor to search foo
- ctX - change from cursor to X
- vap - visual around paragraph
- dd - delete line
- C == c$, D == d$
- df? - DELETE from cursor to find character ?
- vf? - SELECT text from cursor to first character ? finded
- ctrl + v ...select block... + c - change text and click esc ... any combination that you can image. Try: gUaw, etc...
- :%s/findpattern/changefor/ -
- %s/../../c - confirm each sustituitions
- %s/../../g - global
- %s/../../i - case insensive
- %s/../../gic - case insensive global substituition with ask confirmation
- qa // start recurding into 'a' register
- j // move down
- $ // move last char on line
- i // insert mode
- odd //
- esc // back to command mode
- j // move down
- 4@a // replay macro 4 times (if there are 8 more lines)
- v+w, v+$ - select word or select cursor to end line
- shift+v - select line
- va{ - select around block
- vap - select around paragraph
- Ctrl+v - enable viasul block select
- Shift+i - insert mode
- insert text...
- ESC - propagate change
- gU - turn select text to upper case
- gu - turn select text to lower case
- g~ - InverT case
- // in some cases you can use only ~, U or u to combine when another keys, example: vawU (visual around word uppercase)
- \fi - enable indentation folding ! very useful
- za - open/close (toggle)
- zR - open all
- zM - close all
- zf - create folding
- zfa} - create folding around of }
- zc - close folding
- zo - open folding
- zd - delete folding
- // ctrl+n "select how many words you need" after that click "v" and interage with "i" or "a", etc...
- Ctrl + n - select
- Ctrl + p - undo select
- Ctrl - x - jump select
- ctrl + t - new tab
- gt - move next tab
- gT - move previous tab
- :tabc - close current tab
- ctrl+w c - close tab or split
- ctrl + u - move line up
- crtl + d - move line down
- Ctrl+w - work with buffer
- Ctrl+w n - NEW horizontal buffer
- Ctrl+w c - CLOSE current buffer
- Ctrl+w v - NEW vertical buffer
- Ctrl+w s - split current buffer
- Ctrl+w p - move cursor to previous window
- Ctrl+w j or k or l or j - navigate beetwew window
- Ctrl+w = or '-' or '+' - equal size window, decrease increase size
- ctrl + w + < or > - decrease or increse vertical split
- :ls - list all buffers, first column ID buffer
- :buf or :b #ID - reopen buffer
- :bnext, :bprevious, :bfirst, :blast - navigate between buffers
- :bdelete #ID - delete buffer
- \b - list buffers
- \bn - next buffer
- \bp - previous buffer
###Hot tip
- <Ctrl+w r - Ctrl+w - rotate window
- Ctrl+w L - change position split horizontal to vertical, vertical to horizontal
- \b select buffer and key Ctrl+o and choise where you wan open selected buffer
###NerdTree - Hot tip
- add new file or directory via nerdTree
- press m
- choise 'add a childnode' to add file or directory... follow instructions
- press m
- :e . - show list files
-
- after find your file:
-
*o* - split windows and show file
-
*v* - split vertical and show file
-
*t* - open file new tab (use tab navigation)
-
*R* - rename file directory under cursor
-
*D* - delete
-
ctrl + p - search file
-
after search file you can: ctrl+i open with horizontal split ctrl+s open vertical split
-
lead + p - search file with word under cursor
-
lead + w - search by function on ctags index
-
:e vim commando use a context the path where vim start running, you can manipulate de current path. :pwd - show current path :cd "....." - change current path of current window :lcd "...." - change current path all windows
- gf - open file under cursor same window (see .vim.local instrutions for more details)
- Ctrl+w f - open file under cursor split horizontal
- Ctrl+w f or Ctrl+w L - open file, split horizontal, move split to vertical
- qCHARATERNAMEMACRO - initialize record type character NAMEMACRO registry, after finish click "q"
- @CHARATERNAMEMACRO - run commands previous records
-
ctrl+v - open selected file in new vertical split
-
ctrl+t - open selected file in new tab
-
** - map to :
-
ctrl+f - map to /
- ctrl+u - up
- ctrl+d - down
- :FormatJson - equal to type :%!python -m json-tool
- :FormatPerl - equal to type :%!perltidy -q
- :echo @%
- ,, - set paste
- \z - highlight word from under cursor
- SPACE - search on file
- :Ack .... - search PATTERN in files from current directory and subdirectories, with possibilite open file
Example:
def superMethod()
superVar = "hello"
anotherSuperVar = "world"
end
Select variables lines and digit:
:EasyAlign *=
This align all '=' selected
- first split your windows C-w + s (if you want)
- next active conqueTerm inside of splited window with C-x
You need three steps to install this configuration:
- clone this repository
- create a .vim links
- install plugins
Do it:
cd ~/
git clone https://github.com/stvkoch/powerVim.git .powerVim --recursive
ln -s ~/.powerVim ~/.vim
ln -s ~/.powerVim/vimrc ~/.vimrc
vim +:PluginInstall +:qa
You need support lua. You can check if your vim as support to lua run
:echo has('lua')
1 has support to lua, 0 no!
See this if you want reinstall your vim with support to lua https://gist.github.com/stvkoch/622a123a91b9500187fc
Install ctags indexer and turn your VIM a real PHP IDE, navigate between class and function. CTRL+] open class file on cursor like phpStorm For this you need a .ctags folder provide by powerVim.
cd projects/youProjectFolder
cp -R ~/.vim/ctags .ctags
echo ".ctags" >> .gitignore
that's it! Run vim and allways index your code in ctags database
Always you open your vim, he check if exists a .ctags/indexer and run that indexing all code via ctags feature.
If you have some personal configuration, you can create ~/.vimrc.local and put there what you need.
In your project you can create ...project-root-folder/.vimrc.local and add some useful stuffs like
set path=./lib
set path=./vendor
set path=./app/controller
set path=./app/model
set path=./app/view
au BufNewFile,BufRead *.tag set filetype=javascript
au BufNewFile,BufRead *.jsx set filetype=html
...
- see in .vimrc the path of ctags configurated like 'let g:tagbar_ctag_bin...'
- run: git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/vundle