VIM 초고속 탐색
다른 편집기를 사용하면서 내가 놓친 유일한 것은 마우스로 내 자리를 찾는 것입니다. 파일의 특정 영역을 눈으로 볼 수 있고 마우스를 움직이고 거기에있는 클릭만으로 볼 수 있습니다. VIM을 사용하면 jjjjkkkkkkjjjjhhhh ... 거의 다 왔어 hhhhh oh crap 나는 3 개의 문자를 놓쳤다, lll.
나는 마크하는 법을 배우고 있으며 훌륭한 북마크 플러그인을 발견했습니다. 마커를 만들고 파괴하고 <f3>
불행히도 파일이 닫히면 마크가 잊혀집니다.
모두 어떻게 파일을 슈퍼 탐색합니까? 나는 5j7k4j5h 등도 할 수 있다는 것을 알고 있지만, 내 눈을 읽고 내가 정말로 필요한 곳에 커서를 놓을 수있는 플러그인이 있어야한다 ..
또한 / %를 사용하여 특정 용어를 검색하는 방법도 배웠습니다. 도움이되지만 일치하는 모든 문자가 문서 전체에서 강조 표시됩니다.
을 시도해보세요 $ vimtutor
. 시작하는 데 필요한 모든 것을 알려줍니다.
hjkl
적어도 제 경우에는 빙산의 일각이며 거의 사용되지 않습니다.
wWEe
그리고 BbgegE
모두 단어 단위로 이동할 수 있습니다.
w
그리고e
앞으로 이동W
및E
계정에 공백 및 구두점을" here the * marks the default location of the cursor " and each letter shows where you jump when you hit the key. Latin: Lorem ipsum dolor sit amet. * e e e * E E E * w w w w w w w * W W W W W W
b
그리고ge
뒤로 이동,B
및gE
계정으로 공백 및 구두점을Latin: Lorem ipsum dolor sit amet. b b b b * B B B * ge ge ge* ge gE gE gE*
fFtT
특정 문자의 손이 닿지에 사용되는 현재의 라인 과 ;,
에 대해 같은 방향으로 그 동작을 반복하는 데 사용되는 ;
반대의 방향에서 ,
:
fm
다음m
앞으로 점프 ,F
뒤로 이동Latin: Lorem ipsum dolor sit amet. * fm ; ; ; Fm *
tm
다음m
앞으로 이동 ,T
뒤로 이동Latin: Lorem ipsum dolor sit amet. * tm ; ; ; Tm *
/?
현재 커서 위치에서 패턴의 첫 번째 발생으로 이동하는 데 사용됩니다.
/pattern
앞으로 나아 간다Latin: Lorem ipsum dolor sit amet. * /ips
?pattern
뒤로 이동Latin: Lorem ipsum dolor sit amet. ?Lat *
0$
줄의 첫 번째와 마지막 문자로 이동하는 데 사용됩니다.
(whitespace)Latin: Lorem ipsum dolor sit amet.(whitespace)
0 * $
^g_
줄의 첫 번째 및 마지막 인쇄 가능한 문자로 이동하는 데 사용됩니다.
(whitespace)Latin: Lorem ipsum dolor sit amet.(whitespace)
^ * g_
단일 및 결합 ()[]{}
은 구문별로 또는 단락별로 또는 코드 블록별로 코드 블록을 이동하는 데 사용됩니다.
<C-b>
그리고 <C-f>
전후 화면을 스크롤하는 데 사용된다.
<C-u>
그리고 <C-d>
전후 반 화면 스크롤하는 데 사용된다.
H
을 클릭 M
하고 L
커서를 뷰포트의 상단, 중간, 하단으로 각각 이동합니다.
zt
, zz
and zb
move the line under the cursor to the top, middle, bottom of the viewport, respectively.
And so on.
:help motion.txt
will blow your mind.
besides vim's motion command, I find a vim plugin named EasyMotion is pretty useful to navigate, if you are familiar with vimperator or pentadactyl, EasyMotion just bring hint mode back to vim. here is a animated demo and here is the video tutorial. Hope it's helpful for you.
There are a zillion ways to move around in vim, this is one of its really strong areas. I use { and } a lot, which move up and down to the next blank line in that direction. % is useful for moving back and forth to a matching bracket (of any kind). W and B move forward and back by a "word".
It might be worthwhile reviewing the Moving around section of the Vim manual.
vim has mouse support! give this a try (in your .vimrc):
set mouse=a
sidenote: as a screen user, I've found that I also need
set ttymouse=xterm2
for this to work.
personally I prefer to use:
"/<chars><enter>" to quickly move to somewhere ( extremely fast! trust me! )
":<number>" to go to some line,
"ctrl + f/b" to forward/back
"g;" to move to the last editing place.
"w/b" to move by word
"jklh" to move your cursor to the exact position
With option relativenumber
(:help relativenumber - included with Vim 7.3) you can get to the line under your eyes with the a [count]k
or [count]j
movement, which you let you move in current line with movements like ftweb
as explained by @romainl.
Apart from {
, }
, (
, )
, <number>cb
, <number>cB
, <number>cW
and %
, I use such navigating techniques:
ciw
,diw
(ciW
,diW
). etc. to quickly edit/delete word under the cursor (including non-space characters)ci(
,ci"
(ca(
,ca"
), etc. to quickly edit inside parentheses, quotes (including parentheses, quotes). The same applies ford
.- Marks with CAPITAL letters to set them globally (across files) and persistently (when buffer is closed). For instance,
mA
will create global markA
that will be available with'A
command (or`A
to respect column). gf
to go quickly to file under cursorf
,t
(F
,T
) to move to the char, before the char right (left) (use;
to repeat). These are particularly useful ford
andc
commands (use.
to repeat).^]
to move to the tag and^T
to move back.
And lots of others ways to move :)
Check this out for more information: http://www.thegeekstuff.com/2009/03/8-essential-vim-editor-navigation-fundamentals/
P.S. For rails users there is a very useful rails-vim plugin, you may want to check it out too.
this is a good place to learn the main navigation commands, some of the power/speed of vim comes from the combination of movement with action i.e. cw
-> change word, d10j
-> delete 10 lines down etc. Also this and this are interesting reads.
You can :set nohlsearch
to turn off the highlight of your search characters.
I navigate using ctags a lot too.
I have wrote a plugin with super fast navigation in mind, it's called move-less:
https://github.com/anschnapp/move-less
It let's you search the hole file comfortable by scrolling with (h
j
k
l
-keys). You don't change your cursor position while scrolling the hole site (based on folding trick). If you abort your search you just where you started.
For super fast navigation the intension is to use my plugin to get the target position on the screen and then jump to the right position via easymotion (which already was recommended from another answer):
https://github.com/easymotion/vim-easymotion
If you combine both you could even take advance of the jump-history and you can jump between your origin and target destination simply via <c-o>
and <c-i>
.
참고URL : https://stackoverflow.com/questions/8750275/vim-super-fast-navigation
'code' 카테고리의 다른 글
소켓 작업에 대한 제한 시간 설정 (0) | 2020.09.23 |
---|---|
대규모 데이터 처리 Hbase 대 Cassandra (0) | 2020.09.23 |
버튼 비활성화 (0) | 2020.09.23 |
Visual Studio Code가 설치된 git을 감지 할 수 없음 (0) | 2020.09.23 |
npm -D 플래그는 무엇을 의미합니까? (0) | 2020.09.22 |