VIM
Some Vim keys and commands
- entering insert mode
- i/I - insert before cursor/line
- a/A - insert after cursor/line
- o/O - new line after/before
- gi - at last insert position
- cw - delete word + insert mode *navigation
- h,j,k,l - left up down right
- Ctrl+P, Ctrl+N autocompletion
- Navegar
- H, M, L - Ir arriba/medio/bajo en la zona visible
- +/- Ir a la linea siguiente/anterior
- :+8/:-8 Ir a la linea que esta 8 puestos más abajo/arriba
- :6 Ir a la linea numero 6
- Replace:
- :2,3s/^/!/ - Insert ! at the beginning of the lines 2 and 3. See this
- :s/old/new/g - every occurrence
- :s/old/new/c - ask confirmation for each
- :s/old/new/gc
- :%s/old/new - en todo el fichero
- & repeat last :s command
- :s/\v(swap1)(swap2) - swap (swap1swap2 -> swap2swap1)
- :s/something/\r/ - new line
- Delete:
- dd - line
- x, X - character to right, left
- D - to end of line
- Search:
- /word
- n / N - next search match forwards / backwards
- '*' - searches for the word under the cursor
- '#' - backwards
- for selected text see this
--
HecPeAre - 17 May 2008
--
HecPeAre - 20 Jul 2008
Links
gVim Tutorial
http://en.wikibooks.org/wiki/Learning_the_vi_editor/Vim/Useful_things_for_programmers_to_know
http://en.wikibooks.org/wiki/Learning_the_vi_editor
http://devblog.famundo.com/articles/2007/03/08/how-i-learned-to-love-vim-and-ditched-eclipse
http://blog.interlinked.org/tutorials/vim_tutorial.html
http://vimdoc.sourceforge.net/htmldoc/help.html
http://www.mydatabasesupport.com/forums/shell/176751-vi-can-vi-add-characters-range-line-command.html
--
HecPeAre - 03 Oct 2007
.vimrc
#treat your files as UTF-8 and convert everything to UTF (from
here
set encoding=utf8
set fileencoding=utf8
:viusage and :exusage commands, which display a full list of normal and ex mode commands that can be used with Vim.
:vimgrep
echo 'set hlsearch' >> .vimrc # :nohlsearch
set nocompatible " We're running Vim, not Vi!
syntax on " Enable syntax highlighting
set encoding=utf8
set fileencoding=utf8
set hlsearch
filetype plugin indent on " Enable filetype-specific indenting and plugins
" Load matchit (% to bounce from do to end, etc.)
runtime! macros/matchit.vim
augroup myfiletypes
" Clear old autocmds in group
autocmd!
" autoindent with two spaces, always expand tabs
autocmd FileType ruby,eruby,yaml set ai sw=2 sts=2 et
augroup END
--
HecPeAre - 18 May 2008
Tabs
- :tabnew
- Ctrl + Page Up/Down like in Terminal and Firefox
- :tabdo
With Vim's tab implementation, you can use the :tabdo directive to execute a command -- say, a search and replace -- through all open tabs. So, for example, you could run :tabdo %s/oldvariable/newvariable/g to change the name of a variable through two or more files almost as easily as doing the search and replace on a single file. (from
here)
sudo aptitude install vim-rails
rails.vim
http://wiki.rubyonrails.org/rails/pages/HowtoUseVimWithRails
--
HecPeAre - 30 Sep 2007
Comments:
key.mapping
- :map a<C-R>=strftime("%c")
--
HecPeAre - 01 Dec 2007
broken arrow key navigation in insert mode
--
HecPeAre - 01 Dec 2007
GoogleTalk: 7 Habits For Effective Text Editing 2.0
Three basic steps
* Detect inefficiency
* Find a quicker way
* Make it a habit
Vim
:set hlsearch ; -> .vimrc
:nohlsearch
*
folding
Habit 2: Don't type it twice
Cont: min 17.
--
HecPeAre - 18 May 2008
Edit Wikipedia
http://wikipediafs.sourceforge.net/
wget
http://www.vim.org/scripts/download_script.php?src_id=6460
vim README
man mount.wikipediafs
--
HecPeAre - 18 Jun 2008
Related: