Skip to content

Instantly share code, notes, and snippets.

@tdewin
Last active July 23, 2024 11:01
Show Gist options
  • Save tdewin/a525108f535a276aeefe00c5f9c0db34 to your computer and use it in GitHub Desktop.
Save tdewin/a525108f535a276aeefe00c5f9c0db34 to your computer and use it in GitHub Desktop.
VIM shortcuts
"when you use > or < on a V[isual] selected text, shift 2 spaces
set shiftwidth=2
"makes space no tabs
set expandtab
"put 2 spaces for a tab
set tabstop=2
"indicates lines and character location
set ruler
"remap leader from / to ,
:let mapleader=","
"when you type ,k : write the file | apply the current file (%)
"you need to save the file one first time before this can work
:nmap <Leader>k <ESC>:w <bar> :!kubectl apply -f %
"when you type ,e : go to the beginning of the line, find :, go to the right 1 char, delete until the end $ and add a space
:nmap <Leader>e <ESC>0f:lc$<space>
"when you type ,q : quote the word
:nmap <Leader>q <ESC>viw<ESC>bi"<ESC>viw<ESC>ea"
"put the current line in reg, then goes in to expression mode, adds space=space, enter get result
:let mapleader=","
:nnoremap <leader>c A=<esc>0f=c$<esc>v0"ayA<space>=<space><c-r>=<c-r>a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment