Chinese Yellow Pages | Classifieds | Knowledge | Tax | IME

vim cheat sheet

useful .vimrc

set tabstop=2
set shiftwidth=2
set expandtab
inoremap <S-Tab> <C-V><Tab>
syntax on
set t_Co=256
set colorcolumn=80

“crazy vim, do not allow copy/paste
set mouse=v

setlocal spell spelllang=en_us

“for vert term  ( split vertical vim window)

:set splitright
:set splitbelow

 

useful .screenrc

# Enable mouse scrolling and scroll bar history scrolling
termcapinfo xterm* ti@:te@

 

Split Multiple windows:

:vsplit  filename

:split  filename

Ctr-W arrow to move between windows

:vert term  ( bring a term window )

 

Commenting Multiple Lines

Follow the steps given below for commenting multiple using the terminal.

  1. First, press ESC
  2. Go to the line from which you want to start commenting. Then, press ctrl + v, this will enable the visual block mode.( not shift+v)
  3. use the down arrow to select multiple lines that you want to comment.
  4. Now, press SHIFT + I to enable insert mode.
  5. Press # and it will add a comment to the first line. Then press ECS and wait for a second, # will be added to all the lines.

You Might Like: Learn DevOps: The Complete Kubernetes Course 174

Uncommenting Multiple Lines

  1. Press CTRL + V to enable visual block mode.
  2. Move down and select the lines till you want to uncomment.
  3. press x and it will uncomment all the selected lines at once.

 

:help command

remove unwanted space till end

1,$s/\s\+$//g  ( remember to escape + as \+)

:11,22t. (copy 11,22 to current focus)

:11,22m. (move line 11,22 to current focus)

:tabe . ( tabedit open a new tab),   gt, gT switch between tab

line move/edit

w,e,b move to next word, end, backword word ,  ( W, E, B use space as seperator)

r ( replace one char), R ( replace one line)

s (substitutte one char ) , S (substitute one line)

 

 

Please rate this


Comments are closed here.