Add vim into alternatives list
# /usr/bin/vim is a link, /usr/bin/vim73 is a executable, 100 priority
update-alternatives --install /usr/bin/vim editor /usr/bin/vim73 100
# change default editor
update-alternatives --config editor:source $MYVIMRC<CR>H window top
M window middle
L window bottom
:157<CR>, 157G, 157gg go to 157 line
Move to the word you want to search, then press *. Or manually search for some word by typing /{word}.
Move between found words by hitting n or N.
To replace word type cw, then type new word, then <Esc>.
Move to next occurence, then press . to repeat last change.
~ uppercase/lowercase a character
g~w uppercase/lowercase word from cursor until end of a word
g~aw uppercase/lowercase a word in any position
gUaw uppercase a word
guaw lowercase a word
gUU uppercase a line
guu lowercase a line
gUap guap uppercase/lowercase a paragraph
Type <C-n><C-p> or <C-p><C-n> to open auto complete popup, then continue typing, popup items will be filtered as you type.
To choose from list just type <C-n> or <C-p> following by <C-y> or <CR>.
<C-x><C-n> complete from buffer.
<C-x><C-i> complete from included files.
cd ~/.vim/bundle
git clone git://github.com/shawncplus/phpcomplete.vim.gitsudo apt-get install exuberant-ctagsGenerating tags:
# change dir
cd my_project_root_dir_OR_my_framework_root_dir
# generate tags
ctags-exuberant -f php.tags --languages=PHP -R
# tell vim to use our tags file
:set tags=~/path/to/php.tagsOpen up a new PHP file, set the tag file and start typing the name of a class that you know exists. After a few characters type <c-x><c-o> (insert mode) and the omnicompletion will kick in. Then, on the completed class name in command mode, type <c-]>. You will be taken to the class definition, or given a list of definitions if it matches more than one.
Another neat feature is jumping to a tag from the Vim command line. For example, if you know you need to get to the file containing the class MyLovelyClass, just type:
:tag MyLovelyClass
And hit return. You will be taken straight to it. This is almost always quicker than trying to navigate a file tree to find the file you want. Also, this supports tab completion, so you could just type :tag My<tab> and you would get a list of options.
Installing supertab to open omni via Tab instead of <c-n><c-o>
git clone https://github.com/ervandew/supertab.git
Set default completion type in your .vimrc:
let g:SuperTabDefaultCompletionType="<c-x><c-o>"
Open your source file in vim, type some characters, then hit Tab. To navigate in omni type Tab some more time.
<C-h> removes one character (backspace)
<C-w> removes one word back
<C-u> removes one line back
:helptags c:\Program\ Files\ (x86)\Vim\vimfiles\bundle\vimtodo\doc\:cd mydir or to change disk drive on Windows :cd c:\.
Type :e, then space, then hit CTRL-D to list files & directories in the current directory.
Open File Explorer vertically splitting window: :Vex or with :Vexplore or with :Explore!.
Open File Explorer with :Ex or with :Explore.
Open File Explorer horizontally splitting window: :Sexplore.
Open File Explorer in new tab with :Texplore.
Walk between windows with CTRL-w.
Enter to open file or directory.
CTRL-6 to return to File Explorer.
Change netrw window size with :let g:netrw_winsize=25.
Enable netrw file preview :let g:netrw_preview=1.
Preview file under cursor, type p.
Close preview window CTRL-w-z.
It will always check syntax on every write.
:SyntasticInfo show info
:SyntasticCheck php run php checker
To efficiently open a file in the current directory or subdirectories do following:
Set path variable in your vimrc:
set path+=**Change current directory to your project path:
:cd c:\openserver\domains\mysite.loc\Search and open a file:
:find MyController.php
:fin MyController.phpSearch and open a file in new tab:
:tabfind MyController.php
:tabf MyController.php
:tabf myfolder\MyController.phpTo autocomplete file name, for example, type :tabf myfolder\ind then hit <TAB>, Vim will search files and if found autocompletes file name with relative path.
Russian
:set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyzUzbek
:set langmap=ФИСВУАПРШОЛДЬТЎЗЙКҚЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтўзйкқегмцчня;abcdefghijklmnopqrstuvwxyzSuppose, we have following code:
var a='hello world'
var b=123456
var c=nullTo put semicolon (any character or text, no matter) at the end of lines, do following steps:
ggto go to the begin of a file- Switch to visual block mode with
<C-v> - Select lines moving down with
j - Go to end of line with
$ - Switch to append mode with
A(or insert mode withI) - Type
;, then<Esc> - Now Vim puts semicolon at the end of all selected lines