This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:vi [2019/10/31 00:51] – [Useful Commands] tmade | linux:vi [2026/04/07 16:08] (current) – [Visual Mode] tmade | ||
|---|---|---|---|
| Line 12: | Line 12: | ||
| \> #A word ends with | \> #A word ends with | ||
| :set hlsearch | :set hlsearch | ||
| - | % #Jump to closing bracket | + | % #Jump to closing bracket, when curser is on " |
| + | # #Jump to function, when curser is on function or where the function is called (and vice versa) | ||
| | | ||
| ==== Edit ==== | ==== Edit ==== | ||
| Line 51: | Line 52: | ||
| :w !sudo tee % #Save file with sudo rights | :w !sudo tee % #Save file with sudo rights | ||
| :wq !sudo tee % #Save and quit file with sudo rights | :wq !sudo tee % #Save and quit file with sudo rights | ||
| + | :set paste #to avoid linefeeds by pasting code | ||
| + | :set nopaste | ||
| + | :syntax on | ||
| + | :syntax off # | ||
| | | ||
| ====Visual Mode==== | ====Visual Mode==== | ||
| - | If you can´t enter text with right mouse click, set | + | If you can´t enter text with putty and right mouse click, set |
| set mouse-=a | set mouse-=a | ||
| in file | in file | ||
| ~/.vimrc | ~/.vimrc | ||
| + | |||
| + | or | ||
| + | |||
| + | :set mouse= | ||
| | | ||
| + | inside VI. | ||
| + | | ||
| + | Adapt to it - with mouse mode turned on, the new way to paste is | ||
| + | shift-right-click | ||
| + | |||
| + | ====Multi-edit==== | ||
| + | To edit various lines: | ||
| + | |||
| + | - strg +v | ||
| + | - mark all lines with arrow up/ down | ||
| + | - press " | ||
| + | - press tab or space | ||
| + | - escape | ||
| + | | ||
| + | |||
| + | |||
| | | ||