Documente Academic
Documente Profesional
Documente Cultură
Vim/Os saltos
< Vim
Os saltos
Observaçãp: lembre-se '^' equivale a
CTRL, portanto ^I = CTRL-I
Trechos entre colchetes são opcionais
gg
I
Pode-se fazer combinações, por
exemplo:
fx..........move até o
próximo x
dfx.........deleta até o
próximo x
^o
^i
Abrir o último arquivo editado "modo
normal"
'0
'1
gd
10|
[i ........ Mostra a
primeira linha que contém
a palavra sob o cursor
:wn
:wp
:rew[wind]
Ou ir para o primeiro
:fir[ist]
Lista de alterações
O vim mantém uma lista de alterações,
para avançar nas alterações use
g,
g;
:h changes
Abrindo arquivos
rapidamente
Para ser capaz de saltar entre arquivos
sem que o vim reclame configure estas
duas opções no seu arquivo de
configurração
:set hidden
:set path+=**
Ao posicionar o cursor sobre um "nome
de arquivo" você pode digitar 'gf' para
abrir o mesmo
gf
Ctrl-w Ctrl-f
CTRL+6
'0
Lista de saltos
O vim mantém uma listta de saltos, para
vê-la digite
:h jumplist
Ctrl-o
Ctrl-i
Se desejar faça
este mapeamento em seu
~/.vimrc
map ,f :Fi
:Find nome
-------------------8<-
--------------------------
---------------
function!
Find(name)
let l:_name =
substitute(a:name, "\\s",
"*", "g")
let
l:list=system("find . -
iname '*".l:_name."*' -not
-name \"*.class\" -and -
not -name \"*.swp\" | perl
-ne 'print \"$.\\t$_\"'")
let
l:num=strlen(substitute(l:
list, "[^\n]", "", "g"))
if l:num < 1
echo
"'".a:name."' not found"
return
endif
if l:num != 1
echo
l:list
let
l:input=input("Which ?
(<enter>=nothing)\n")
if
strlen(l:input)==0
return
endif
if
strlen(substitute(l:input,
"[0-9]", "", "g"))>0
echo
"Not a number"
return
endif
if
l:input<1 || l:input>l:num
echo
"Out of range"
return
endif
let
l:line=matchstr("\n".l:lis
t,
"\n".l:input."\t[^\n]*")
else
let
l:line=l:list
endif
let
l:line=substitute(l:line,
"^[^\t]*\t./", "", "")
execute ":e
".l:line
endfunction
command! -nargs=1
Find :call Find("<args>")
-------------------8<-
--------------------------
---------------
Obtido em
"https://pt.wikibooks.org/w/index.php?
title=Vim/Os_saltos&oldid=453627"