tuto:linux:vimrc
Ceci est une ancienne révision du document !
vim
- https://vim.rtorr.com/ (raccourcis vim)
vim
map
Affiche les mapping clavier :
:map :verbose map
Voir si un mapping existe (par exemple <Ctrl>+<d>
:
:map <C-d>
- n : normal mode
- v : visual mode
- s : select mode (texte de remplacement en mode visual)
- o : operator-pending mode
- i : insert mode
- c : commande-line mode (après un
:
ou/
)
- <Space> : Normal, Visual, Select and Operator-pending
- n : Normal
- v : Visual and Select
- s : Select
- x : Visual
- o : Operator-pending
- ! : Insert and Command-line
- i : Insert
- l :
:lmap
mappings for Insert, Command-line and Lang-Arg - c : Command-line
ls
Affiche la liste des buffers :
:ls
Plugins
NERDTree
<C-e>
: to toggle NERDTree<leader>e
or<leader>nt
to load NERDTreeFind which opens NERDTree where the current file is located.
ctrlp.vim
<C-p>
: ouvre CtrlP
Once CtrlP is open :
- Press
<F5>
to purge the cache for the current directory to get new files, remove deleted files and apply new ignore options. - Press
<c-f>
and<c-b>
to cycle between modes. - Press
<c-d>
to switch to filename search instead of full path. - Press
<c-r>
to switch to regexp mode. - Use
<c-j>
,<c-k>
or the arrow keys to navigate the result list. - Use
<c-t>
or<c-v>
,<c-x>
to open the selected entry in a new tab or in a new split. - Use
<c-n>
,<c-p>
to select the next/previous string in the prompt's history. - Use
<c-y>
to create a new file and its parent directories. - Use
<c-z>
to mark/unmark multiple files and<c-o>
to open them.
vim-surround
Objectif | Avant | Vim | Après |
---|---|---|---|
Delete quotes surrounding a sentence | “Hello world!” | ds“ | Hello world! |
Delete surrounding tags | <p>Start here</p> | dst | Start here |
Delete surrounding parentheses in some code | (var1, var2) | ds( | var1, var2 |
vimrc
Exemple de fichier .vimrc
:
- .vimrc
execute pathogen#infect() syntax on filetype plugin indent on colorscheme torte " colorscheme slate "set bg=light set expandtab " tabs are spaces set tabstop=4 " number of visual spaces per TAB set softtabstop=4 " number of spaces in tab when editing set shiftwidth=4 "set number " Afficher la numerotation des lignes set showcmd " show command in bottom bar set wildmenu " visual autocomplete for command menu set nohlsearch " disable highlight matches set ignorecase " ignore case when searching set history=1000 " remember more commands and search history set undolevels=1000 " use many muchos levels of undo set visualbell " don't beep set t_vb= " desactive le clignotement de visualbell set noerrorbells " don't beep set paste " Mode copie set mouse=nv "Gestion de la souris (permet de coller) " set mouse=a "Gestion de la souris if has("autocmd") au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif endif let g:airline#extensions#tabline#enabled = 1 " Autocompletion set omnifunc=syntaxcomplete#Complete " Raccourcis nmap <C n> :bn<CR> nmap <C p> :bp<CR> nmap <F2> :TagbarToggle<CR> nmap <F3> :NERDTreeToggle<CR> set pastetoggle=<F4> " Passer en mode copie " Par defaut la touche shift permet le meme comportement "map <F5> :exec &mouse!=""? "set mouse=" : "set mouse=nv"<CR>
Debug
- Démarrer sans fichier
.vimrc
:
$ vim -u NONE
- Mesurer le temps :
$ vim --startuptime timeCost.txt timeCost.txt
:profile start profile.log :profile func * :profile file * " At this point do slow actions :profile pause :noautocmd qall
tuto/linux/vimrc.1483386890.txt.gz · Dernière modification : 2017/01/02 19:54 de root