Skip to content

Instantly share code, notes, and snippets.

@s3rgeym
Created April 3, 2021 11:55
Show Gist options
  • Save s3rgeym/f3dc0a55cd89e8a23a9b05a855fbf060 to your computer and use it in GitHub Desktop.
Save s3rgeym/f3dc0a55cd89e8a23a9b05a855fbf060 to your computer and use it in GitHub Desktop.
Vim and vimium shortcuts

Select and copy (works on vimium)

  • / to find text
  • v to enter visual mode
  • y to yank/copy

Duplicate line

  • v to enter visual mode
  • y to yank/copy
  • p to paste in the next line

Split horizontally

  • :sp

Split vertically

  • :vsp

Repeat last change in NORMAL mode

  • .

Resizing panes

Ctrl+W +/-: increase/decrease height (ex. 20<C-w>+)
Ctrl+W >/<: increase/decrease width (ex. 30<C-w><)
Ctrl+W _: set height (ex. 50<C-w>_)
Ctrl+W |: set width (ex. 50<C-w>|)
Ctrl+W =: equalize width and height of all windows

Repeat last command

  • @:

Offtopic

TMUX shortcuts

  • Ctrl+b c Create a new window (with shell)
  • Ctrl+b w Choose window from a list
  • Ctrl+b 0 Switch to window 0 (by number )
  • Ctrl+b , Rename the current window
  • Ctrl+b % Split current pane horizontally into two panes
  • Ctrl+b " Split current pane vertically into two panes
  • Ctrl+b o Go to the next pane
  • Ctrl+b ; Toggle between current and previous pane
  • Ctrl+b x Close the current pane

Own key mappings

 44 " Move across panes
 45 nnoremap <C-h> <C-w>h
 46 nnoremap <C-j> <C-w>j
 47 nnoremap <C-k> <C-w>k
 48 nnoremap <C-l> <C-w>l
 49 " Move across buffers
 50 nnoremap < :bp<CR>
 51 nnoremap > :bn<CR>
 52 " Undo/redo
 53 nnoremap <C-Z> u
 54 nnoremap <C-Y> <C-R>
 55 " Toggle search highlight
 56 nnoremap <F3> :set hlsearch!<CR>
 57 " Move lines up/down
 58 nnoremap <S-Up> :m-2<CR>
 59 nnoremap <S-Down> :m+<CR>
 60 inoremap <S-Up> <Esc>:m-2<CR>
 61 inoremap <S-Down> <Esc>:m+<CR>
 62 " Split panes
 63 map <Leader>\| :vsp<CR>
 64 map <Leader>- :sp<CR>
 65 " Toggle Nerdtree
 66 map <C-n> :NERDTreeToggle<CR>
 67 " Ctrl-Backspace deletes word in INSERT mode
 68 noremap! <C-BS> <C-w>
 69 " hack?
 70 noremap! <C-h> <C-w>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment