:set hlsearch (:nohl)
:set mouse=a
:set nocompatible
:set smartindent
:set nowrapscan (to disable the wrap search)
:highlight String ctermfg=red
:highlight search ctermfg=black
- use UP DOWN arrows (or j/k keys) to select the lines
- press I (shift + i) (this enters into visual mode)
- type "//"
- Once you press ESC, the // will be applied to all the lines you selected.
- select RIGHT LEFT arrows to select only the "//" characters
- press "d" (to delete all the // characters)
- To indent a block of code, keep the cursor in any of the {} braces, and do =%
- To comment a block of line, keep the cursor in the first line (from where you want to comment),
- use UP DOWN arrows (or j/k keys) to select the lines
- press I (shift + i) (this enters into visual mode)
- type "//"
- Once you press ESC, the // will be applied to all the lines you selected.
- To uncomment a block of code, keep the cursor in the first line (from where you want to uncomment)
- select RIGHT LEFT arrows to select only the "//" characters
- press "d" (to delete all the // characters)
- To search and replace a text ("src" to "dest"), use
:%s/src/dest/ ==> Replaces first occurence of "src" in each line
:%s/src/dest/g ==> Replaces all the occurences of "src" with "dest" in all the lines
:%s/src/dest/gc ==> Asks for confirmation to replace or not for each occurence
- Vimdiff commands:
- ]c - to go to the next change
- [c - to go to the previous change
- do - diff obtain; means get the changes from other file
- dp - diff put; means put the changes into other file
No comments:
Post a Comment