Skip to content

Instantly share code, notes, and snippets.

@tjmgregory
Last active December 1, 2020 09:41
Show Gist options
  • Save tjmgregory/cc267def5507b1ee34ac6fe19fd7875f to your computer and use it in GitHub Desktop.
Save tjmgregory/cc267def5507b1ee34ac6fe19fd7875f to your computer and use it in GitHub Desktop.
Vim Run Commands
" General
" Line numbers
set number
" Syntax highlighting
syntax on
colo pablo
filetype plugin indent on
" Allow backspace to delete indentation and inserted text
" i.e. how it works in most programs
set backspace=indent,eol,start
" indent allow backspacing over autoindent
" eol allow backspacing over line breaks (join lines)
" start allow backspacing over the start of insert; CTRL-W and CTRL-U
" stop once at the start of insert.
" Spaces not tabs
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab
" Tab navigation
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Right> :tabnext<CR>
nnoremap <silent> <A-Left> :execute 'silent! tabmove ' . (tabpagenr()-2)<CR>
nnoremap <silent> <A-Right> :execute 'silent! tabmove ' . (tabpagenr()+1)<CR>
" Flash screen instead of beep sound
set visualbell
" Change how vim represents characters on the screen
set encoding=utf-8
" Set the encoding of files written
set fileencoding=utf-8
" NERDTree
" Open with vim if no file specified
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" File visibility
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\.DS_Store$', '\.git$'] " ignore files in nerd tree
map <C-n> :NERDTreeToggle<CR>
" Allow deleting files
set modifiable
" coc
let g:coc_global_extensions = [ 'coc-tsserver' ]
" Golang
" Run goimports along gofmt on each save
let g:go_fmt_command = "goimports"
"Automatically get signature/type info for object under cursor
let g:go_auto_type_info = 1
" Autocomplete on . press
au filetype go inoremap <buffer> . .<C-x><C-o>
" Ag (Better Ack)
let g:ackprg = 'ag --nogroup --nocolor --column'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment