Skip to content

Instantly share code, notes, and snippets.

@y0mbo
Last active December 15, 2020 02:14
Show Gist options
  • Save y0mbo/3005172 to your computer and use it in GitHub Desktop.
Save y0mbo/3005172 to your computer and use it in GitHub Desktop.
My .vimrc file
set nocompatible
syntax enable
set encoding=utf-8
set showcmd
filetype plugin indent on
colorscheme cobalt2
" turn off backups
set nobackup
set nowb
"" whitespace
set nowrap
set tabstop=2 shiftwidth=2
set smarttab
set expandtab
set backspace=indent,eol,start
set number
set hlsearch
set incsearch
set ignorecase
set smartcase
" Use ctrl-[hjkl] to select the active split!
nmap <silent> <c-k> :wincmd k<CR>
nmap <silent> <c-j> :wincmd j<CR>
nmap <silent> <c-h> :wincmd h<CR>
nmap <silent> <c-l> :wincmd l<CR>
set showmatch
set mat=2
" command mappings
command W w
" Map space to / (search) and c-space to ? (backgwards search)
map <space> /
map <c-space> ?
map <silent> <leader><cr> :noh<cr>
" Smart way to move btw. windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" => Parenthesis/bracket expanding
inoremap { {}<Left>
inoremap {<CR> {<CR>}<Esc>O
inoremap {{ {
inoremap {} {}
inoremap ( ()<Left>
inoremap (<CR> (<CR>)<Esc>O
inoremap (( (
inoremap () ()
inoremap [ []<Left>
inoremap [<CR> [<CR>]<Esc>O
inoremap [[ [
inoremap [] []
" disable the arrow keys. just to be a badass
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>
" => Parenthesis/bracket expanding
vnoremap $1 <esc>`>a)<esc>`<i(<esc>
vnoremap $2 <esc>`>a]<esc>`<i[<esc>
vnoremap $3 <esc>`>a}<esc>`<i{<esc>
vnoremap $$ <esc>`>a"<esc>`<i"<esc>
vnoremap $q <esc>`>a'<esc>`<i'<esc>
vnoremap $e <esc>`>a"<esc>`<i"<esc>
" Map auto complete of (, ", ', [
inoremap $1 ()<esc>i
inoremap $2 []<esc>i
inoremap $3 {}<esc>i
inoremap $4 {<esc>o}<esc>O
inoremap $q ''<esc>i
inoremap $e ""<esc>i
inoremap $t <><esc>i}}
" jj or kk takes you out of insert mode
imap jj <Esc>
imap kk <Esc>
" Make powershell the default shell
set shell=powershell
set shellcmdflag=-command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment