Skip to content

Instantly share code, notes, and snippets.

@kondor6c
Created June 10, 2018 23:39
Show Gist options
  • Save kondor6c/4048b78103f9d3991b60b94c0cad1081 to your computer and use it in GitHub Desktop.
Save kondor6c/4048b78103f9d3991b60b94c0cad1081 to your computer and use it in GitHub Desktop.
" Vimrc
" | Action | Emacs | Vim |
" |--------------------------------:|:--------------:|:------------------------|
" |undo (nano: M-U) | C-_ | u |
" |redo (nano: M-E) | C-_ (note) | C-r |
" |save (nano: C-x) | C-x C-s | :w |
" |quit (abort) (nano: C-x) | C-x C-c | :q! |
" |search (nano: C-/) | C-s | / |
" |replace (nano: C-/) | Esc % (dialog) | :%s/paittern/pattern/g |
" |insert | i (or) I | |
" |append | a (or) A | |
" |insert newline | | o (or) O |
" |open | C-x C-f | :e ~/file.txt |
" |Set mark visual (nano: M-A-M) | C-@ | V (or) v |
" |Cut (nano: C-k) | C-k | D |
" |Yank (copy) (nano: M-6) | M-w | y |
" |Paste (nano: C-u) | C-y | p (or) P |
" |delete (full line) (nano: C-k) | C-M-Backspace | dd |
" |move forard one word (nano: C-arrow) | M-f | w |
" |end of line (nano: C-e) | C-e | $ |
" |beginning of line (nano: C-a) | C-a | 0 |
" |end of file (nano: C-_ C-Y) | Esc-> | gg |
" |beginning of file (nano: C-_ C-V) | Esc-< | G |
" |Record new | C-x-( | qc |
" #Advanced:
" |Stop recording | C-x-) | q |
" |Replay | C-u-2-C-x-e (2x) | 2@c |
" |ex: add # in the beginning of the line | C-x-(,C-a,#,C-x-) | qc0i#C-[0jq |
" |ex: Delete \n, making one big string | C-x-(,C-e,DEL (key),C-x-) | qd$x$q|
" |New buffer | C-x b Named |:new 0 or :vnew|
" |Split screen horizontal | C-x 3 | :split |
" |Split screen vertical | C-x 2 | :vsplit |
" |Change buffer focus | C-x o | C-w C-w |
" |Close buffer | C-x k (or) C-x 0 | :q (on focus) |
" |regular expression search | C-M-s | /.*char\&other|
" |run a command and edit output | C-u M-! |:r !dig or :.!x|
syntax enable
colorscheme evening
set ruler
set nocompatible
set ts=4
" Put plugins and dictionaries in this dir (also on Windows)
let vimDir = '$HOME/.vim'
let &runtimepath.=','.vimDir
" I constantly found this annoying, but I should call commands from within vim
" Keep undo history across sessions by storing it in a file
if has('persistent_undo')
let myUndoDir = expand(vimDir . '/undodir')
" Create dirs
call system('mkdir ' . vimDir)
call system('mkdir ' . myUndoDir)
let &undodir = myUndoDir
set undofile
endif
inoremap jj <Esc>
if filereadable("~/.vimrc.d")
for f in split(glob('~/.vimrc.d/*.vim'), '\n')
exe 'source' f
endfor
endif
"custom macros:
let @c='qc0i#^[0jq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment