Skip to content

Instantly share code, notes, and snippets.

@manzaloros
Last active January 31, 2021 03:32
Show Gist options
  • Select an option

  • Save manzaloros/a1e16bb0ebb3eca65e896b4dff83edfa to your computer and use it in GitHub Desktop.

Select an option

Save manzaloros/a1e16bb0ebb3eca65e896b4dff83edfa to your computer and use it in GitHub Desktop.
My .vimrc
" leader as spacebar
let mapleader = " "
" Enable syntax highlighting
syntax on
" Search Highlighting
set hlsearch
" Mute highlighting
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
" Preview first match before execution
set incsearch
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬
" From sensible vim
set backspace=indent,eol,start
" Autoindent
set autoindent
set shiftwidth=2
set number
set expandtab
set tabstop=2
set softtabstop=2
" Spellcheck. Remove this if annoying!
" :setlocal spell spelllang=en_us
" break by word rather than character
set linebreak
set wrap
" Bracket autocompletion
inoremap { {}<Left>
inoremap {<CR> {<CR>}<Esc>O
inoremap {{ {
inoremap {} {}
" colemak nn instead of 'jj' to escape in INSERT mode
" inoremap nn <Esc>
" Puts cursor inside parens
inoremap ( ()<Left>
" Doesn't type closing parens twice
inoremap <expr> ) strpart(getline('.'), col('.')-1, 1) == ")" ? "\<Right>" : ")"
" Single or double quotes autocompletion
inoremap <expr> ' strpart(getline('.'), col('.')-1, 1) == "\'" ? "\<Right>" : "\'\'\<Left>"
" Set default font size (in macvim)
set guifont=Monaco:h24
" Change cursor shape between insert and normal mode in iTerm2.app
if $TERM_PROGRAM =~ "iTerm"
let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in insert mode
let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Block in normal mode
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment