keep them by heart, fugitive
Fugitive Vim cheatsheet
basic cheatsheet
Tip 1. hightlight search
끄기
- #hightlight, #unimpared
문제 상황
- vim에서 특정 단어 위에서
*
을 하거나 serach를 하게되면 찾은단어에 highlight 색상이 표기된다. - 찾은 목적이 완료된 뒤에 highlight가 너무 눈에 튀어 끄고 싶을 때 어떻게 하지?
관련 링크
plugin이 설치되지 않은 vim에서의 해결책
- 다음번 서치까지 highlight를 끄고자 할 때
:noh
- hightlight 기능을 완전히 끄고 싶을 때
set nohlsearch
- 토글하려면 ( F3 키에 할당한 예제 )
set hlsearch! nnoremap <F3> :set hlsearch!<CR>
plugin이 설치된 상태일때
- 관련 답변 링크: there are two
must have
plugins for this: - 나는
unimpared
를 설치했기 때문에…[oh
-:set hlsearch
]oh
-:set nohlsearch
yoh
-hlsearch
토글 ( 위 답변에는coh
로 되어있지만, 최근 버전에서 댓글과 같이yoh
로 변경됨 )
basic cheatsheet
Note:
## Vim Cheat Sheet
### Navigation
- End of the file: shift + g
- Next line: j
- Go down a defined number of lines: number + j
- Skip to next word: w
- Skip back a word: b
- Skip to next section: W
- Skip back to previous section: B
- Go to end of the line: $
- Go to beginning of the line: 0
- Go to top of the screen: shift + h
- Go to bottom of the screen: shift + l
- Forward multiple words: 5w
- Forward multiple letters: 5l
- Back multiple letters: 5h
- Forward to the next 'y': fy (case sensitive)
### Editing
- Undo: u
- Redo: ctrl + r
- Inserting text where the cursor is: i
- Inserting text at the start of the line: I
- Insert at the end of the line: shift + a
- Copy entire line: yy or Y
- Paste copied line: p
- Change multiple words: 5cw
- Insert at the end of the line: A
### Deleting
- d will delete current and left character
- d$ will delete from current position to end of line
- d^ will delete from current backward to first non-white-space character
- d0 will delete from current backward to beginning of line
- dw deletes current to end of current word (including trailing space)
- db deletes current to beginning of current word
- Delete current line: dd
- Join the line below: shift + j
- Delete entire word: cw
- Delete to the end of the line: shift + C
- Delete multiple lines: d + number of lines + enter
- Delete from current position to a specific line number: dG
- Deleting all items in a file that start with a pattern: :g/< search term>/d
- Deleting all lines that are empty or that contain only whitespace: :g/^\s*$/d
### Selecting
- Select the entire line: V
- Select a range of text: v
- Select a column: control + v
- Reselect a block: gv
- Select all: ggVG
### Find and Replace
- %s/pattern/text to replace
### Saving
- Save the file: :w
- Save the file and quit: :wq
- Quit without saving: :q!
### Views
- Use horizontal split: :sp filename
- Use vertical split: :vsp filename
- Switch from top to bottom: control + w + j
- Switch from left to right: control + w + l
- Switch from bottom to top: control + w + j
- Switch from right to left: control + w + h
### Search
- While on current line: f +
- Search for word in file: /word + enter
- Find next search result: n
- Search backwards: N
- Go to first result: ggn
- Go to last result: GN
- To remove search highlighting: :noh
### Modes
- Normal
- Insert
- Visual
- Replace
- Command Line
### Multiple Files
- :e filename - Edit a file in a new buffer
- :bnext (or :bn) - go to next buffer
- :bprev (of :bp) - go to previous buffer
- :bd - delete a buffer (close a file)
- :sp filename - Open a file in a new buffer and split window
- ctrl + ws - Split windows
- ctrl + ww - switch between windows
- ctrl + wq - Quit a window
- ctrl + wv - Split windows vertically
### Indenting
- Fix indenting when pasting: set paste in .vimrc file
- Indenting: visual mode + > or <
- Repeat indenting: .
## Commenting/Uncommenting
- Comment: visual block select with CTRL-V then I# (insert # in the begining)
- Uncomment: visual block select with CTRL-V then X (delete the first symbol on the line)
### Visual Mode
- Changing multiple lines of text: control + v + shift + i + action + esc
- Select elements in paragraph: v + / + content
### Display settings
- Turning on line numbers: :set nu
- Turning on syntax highlighting: :syntax on
### Reseting Vim Settings
```
cd
mv .vimrc .vimrc-old
mv .vim .vim-old
touch .vimrc; mkdir .vim
```
### Help
- To get help: :h
- To exit help: :bd
### Removing blocks of text in code files
- `c + i + t` will remove the code between HTML tags, such as: `
Some content
`
- `c + i + }` will remove the code inside of a JavaScript function
</div>
[news]: news.html
[yoga]: yoga.html
[drones]: drones
[freelancers]: freelancers
[p1_landing_page]: p1_landing_page.html
[p2_landing_page]: p2_landing_page.html
[titlepage]: titlepage.html
[tocpage]: tocpage.html
[index]: index.html
[mydoc_aboutsite]: mydoc_aboutsite.html
[mydoc_supported_features]: mydoc_supported_features.html
[mydoc_about]: mydoc_about.html
[mydoc_support]: mydoc_support.html
[mydoc_ansible]: mydoc_ansible.html
[mydoc_webhook]: mydoc_webhook.html
[mydoc_pipeline]: mydoc_pipeline.html
[mydoc_docker]: mydoc_docker.html
[mydoc_gitlab]: mydoc_gitlab.html
[mydoc_django]: mydoc_django.html
[mydoc_rostopic]: mydoc_rostopic.html
[mydoc_gcs_web]: mydoc_gcs_web.html
[mydoc_rqt]: mydoc_rqt.html
[mydoc_webrtc]: mydoc_webrtc.html
[mydoc_mqtt]: mydoc_mqtt.html
[mydoc_actions]: mydoc_actions.html
[mydoc_heroku]: mydoc_heroku.html
[mydoc_others]: mydoc_others.html
[mydoc_oscar]: mydoc_oscar.html
[mydoc_raspi]: mydoc_raspi.html
[mydoc_lora]: mydoc_lora.html
[mydoc_drone]: mydoc_drone.html
[mydoc_content_reuse]: mydoc_content_reuse.html
[mydoc_collections]: mydoc_collections.html
[mydoc_webstorm_text_editor]: mydoc_webstorm_text_editor.html
[mydoc_atom_text_editor]: mydoc_atom_text_editor.html
[mydoc_djangovue]: mydoc_djangovue.html
[mydoc_weather]: mydoc_weather.html
[mydoc_chatapp]: mydoc_chatapp.html
[mydoc_bootstrap]: mydoc_bootstrap.html
[mydoc_lightup]: mydoc_lightup.html
[mydoc_lightupadmin]: mydoc_lightupadmin.html
[mydoc_dalrc]: mydoc_dalrc.html
[mydoc_skyhero]: mydoc_skyhero.html
[mydoc_minicp]: mydoc_minicp.html
[mydoc_devnazam]: mydoc_devnazam.html
[xugong]: xugong.html
[mydoc_labels]: mydoc_labels.html
[mydoc_hyperlinks]: mydoc_hyperlinks.html
[mydoc_navtabs]: mydoc_navtabs.html
[mydoc_tables]: mydoc_tables.html
[mydoc_syntax_highlighting]: mydoc_syntax_highlighting.html
[mydoc_workflow_maps]: mydoc_workflow_maps.html
[mydoc_pixhwak_overview]: mydoc_pixhwak_overview.html
[rfly_starthere]: rfly_starthere.html
[books_rflyintroduction]: books_rflyintroduction.html
[mydoc_rfly_cube]: mydoc_rfly_cube.html
[mydoc_apmdr]: mydoc_apmdr.html
[mydoc_cube]: mydoc_cube.html
[mydoc_quad]: mydoc_quad.html
[mydoc_s1000]: mydoc_s1000.html
[mydoc_s100a2]: mydoc_s100a2.html
[mydoc_s900]: mydoc_s900.html
[mydoc_nazam]: mydoc_nazam.html
[mydoc_iterm_profiles]: mydoc_iterm_profiles.html
[mydoc_push_build_to_server]: mydoc_push_build_to_server.html
[mydoc_publishing_github_pages]: mydoc_publishing_github_pages.html
[mydoc_yuneec]: mydoc_yuneec.html
[mydoc_bebop]: mydoc_bebop.html
[mydoc_jetbot]: mydoc_jetbot.html
[mydoc_xavier]: mydoc_xavier.html
[mydoc_vtol]: mydoc_vtol.html
[mydoc_mycourse]: mydoc_mycourse.html
[mydoc_deeplearning]: mydoc_deeplearning.html
[mydoc_cplus]: mydoc_cplus.html
[mydoc_webscraping]: mydoc_webscraping.html
[mydoc_challenger-project]: mydoc_challenger-project.html
[mydoc_aiotoverview]: mydoc_aiotoverview.html
[mydoc_sensor_detection]: mydoc_sensor_detection.html
[mydoc_realsense_drone]: mydoc_realsense_drone.html
[mydoc_edison_arduino]: mydoc_edison_arduino.html
[tag_collaboration]: tag_collaboration.html
[tag_troubleshooting]: tag_troubleshooting.html
[mydoc_jetson_nano]: mydoc_jetson_nano.html
[mydoc_jetson_xavier]: mydoc_jetson_xavier.html
[mydoc_raspi]: mydoc_raspi.html
[mydoc_serializer]: mydoc_serializer.html
[mydoc_lora_monitoring]: mydoc_lora_monitoring.html
[mydoc_fiction]: mydoc_fiction.html
[book-how-javascript-works]: book-how-javascript-works.html
[book-effective-python-2nd]: book-effective-python-2nd.html
[cplus]: cplus.html
[mydoc_webdev]: mydoc_webdev.html
[mydoc_twoscoops]: mydoc_twoscoops.html
[books_revealjs]: books_revealjs.html
[books_vim]: books_vim.html
[books_robotswithros]: books_robotswithros.html
[books_matlab_essential]: books_matlab_essential.html
[mydoc_contact]: mydoc_contact.html
[aigenerative_smartfarm]: aigenerative_smartfarm.html
[quasar]: quasar.html
[iot-network]: iot-network.html
[smartfarm-backend]: smartfarm-backend.html
[aigenerative_nodered]: aigenerative_nodered.html
[iot-network]: iot-network.html
[tag_collaboration]: tag_collaboration.html
[tag_troubleshooting]: tag_troubleshooting.html
[aigenerative_insights]: aigenerative_insights.html
[HF-framework]: HF-framework.html
[langchain]: langchain.html
[gpt4all]: gpt4all.html
[aigenerative_overview]: aigenerative_overview.html
[aigenerative_rag]: aigenerative_rag.html
[3d-human-pose-estimation]: 3d-human-pose-estimation.html
[metafactory]: metafactory.html
[digital-twin]: digital-twin.html
[edge-ai]: edge-ai.html
[vision-ai]: vision-ai.html
[vision-ai]: vision-ai.html
[titlepage]: titlepage.html
[tocpage]: tocpage.html
[p1_landing_page]: p1_landing_page.html
[p1_sample1]: p1_sample1.html
[p1_sample2]: p1_sample2.html
[p1_sample3]: p1_sample3.html
[p1_sample4]: p1_sample4.html
[p1_sample5]: p1_sample5.html
[p1_sample6]: p1_sample6.html
[p1_sample7]: p1_sample7.html
[titlepage]: titlepage.html
[tocpage]: tocpage.html
[p2_landing_page]: p2_landing_page.html
[p2_sample1]: p2_sample1.html
[p2_sample2]: p2_sample2.html
[p2_sample3]: p2_sample3.html
[p2_sample4]: p2_sample4.html
[p2_sample5]: p2_sample5.html
[p2_sample6]: p2_sample6.html
[p2_sample7]: p2_sample7.html
[p2_sample8]: p2_sample8.html
[p2_sample9]: p2_sample9.html
[p2_sample10]: p2_sample10.html
[p2_sample11]: p2_sample11.html
[p2_sample12]: p2_sample12.html
[p2_sample13]: p2_sample13.html
[p2_sample14]: p2_sample14.html
[category]: category
[tag]: tag.html
[tags]: tags.html
[tocpage]: tocpage.html
[drones_overview]: drones_overview.html
[freelancers]: freelancers.html
[yoga]: yoga.html
[bikram]: bikram.html
[hatha]: hatha.html
[mycourse]: mycourse.html
[wiki]: wiki.html
[book-how-javascript-works]: book-how-javascript-works.html
[book-effective-python-2nd]: book-effective-python-2nd.html
[cplus]: cplus.html
[rflysim]: rflysim.html
[vim-basic]: vim-basic.html
[news]: news
[2021-10-31-in-making-it]: 2021-10-31-in-making-it.html
[mydoc_introduction]: mydoc_introduction.html
[p2_mobis]: p2_mobis.html
[p2_skydrones]: p2_skydrones.html
[drones]: drones.html
[freelancers]: freelancers.html
[yoga]: yoga.html
[mycourse]: mycourse.html
[wiki]: wiki.html