Skip to content

Instantly share code, notes, and snippets.

@lukekrikorian
Created June 25, 2021 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukekrikorian/95a6ba6717e95be6bb532863b2fe39a2 to your computer and use it in GitHub Desktop.
Save lukekrikorian/95a6ba6717e95be6bb532863b2fe39a2 to your computer and use it in GitHub Desktop.
syntax on
filetype plugin indent on
set autowrite
set encoding=utf-8
set cmdheight=2
" For standard vim, ctrl-v for paste, and ctrl-z to undo
:inoremap <C-v> <C-o>"*p
:imap <C-z> <C-o>u
" Command-r to run Go
:map <D-r> <Esc> :!go run .<CR>
" Command-. to stop running
:map <D-.> <press Ctrl-C> | execute 'redraw!'
" Command-Shift-, to open vimrc
:map <D-<> :e ~/.vimrc<CR>
" MacVim font settings
set gfn=Monaco:h16
" File shortcuts
command Zsh :e ~/.zshrc
command Main :cd ~/go/handshake | :e main.go
" Brackets closing
"inoremap { {}<Left>
"inoremap {<CR> {<CR>}<Esc>O
"inoremap {{ {
"inoremap {} {}
" Switch window
nnoremap <D-j> <C-W><C-W>
" Backspace in visual
xnoremap <BS> d i <Left>
" go-vim
map <C-n> :cnext<CR>
map <C-m> :cprevious<CR>
nnoremap <leader>a :cclose<CR>
" Coc specific features
set updatetime=300
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
nmap <leader>cr <Plug>(coc-rename)
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
if has("patch-8.1.1564")
set signcolumn=number
else
set signcolumn=yes
endif
" Colorscheme
let macvim_skip_colorscheme = 1
set tabstop=4
set softtabstop=0 noexpandtab
set shiftwidth=4
" vim-plug
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
"Plug 'arzg/vim-colors-xcode'
Plug 'morhetz/gruvbox'
Plug 'preservim/nerdcommenter'
Plug 'preservim/nerdtree'
Plug 'jiangmiao/auto-pairs'
call plug#end()
autocmd vimenter * ++nested colorscheme gruvbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment