Skip to content

Instantly share code, notes, and snippets.

@richardbowden
Created September 16, 2020 02:30
Show Gist options
  • Select an option

  • Save richardbowden/8d117c1fe494637178f6a9d581c1075d to your computer and use it in GitHub Desktop.

Select an option

Save richardbowden/8d117c1fe494637178f6a9d581c1075d to your computer and use it in GitHub Desktop.
call plug#begin('~/.local/share/nvim/plugged')
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'majutsushi/tagbar'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'universal-ctags/ctags'
Plug 'tweekmonster/startuptime.vim'
Plug 'tpope/vim-commentary'
Plug 'jiangmiao/auto-pairs'
" Langs
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" C spcific
Plug 'rohbotics/vim-clang-format'
Plug '/Users/richard/Downloads/Dracula\ PRO\ —\ Zeno\ Rocha\ 3/themes/vim'
call plug#end()
"External Hosts
let g:python_host_prog = '/Users/richard/.pyenv/versions/neovim2/bin/python'
let g:python3_host_prog = '/Users/richard/.pyenv/versions/neovim3/bin/python'
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Give more space for displaying messages.
set cmdheight=2
set noswapfile
" UI
set termguicolors " enables true color
set background=dark
colorscheme dracula_pro
" other settings
set hidden
set nobackup
set nowritebackup
set number
let mapleader="\<Space>"
set splitbelow "horizontal split open below
set splitright "vertical split open to the right
set clipboard+=unnamedplus
set hlsearch " highlight search results
set tabstop=4 " number of columns occupied by a tab character
set softtabstop=4 " see multiple spaces as tabstops so <BS> does the right thing
set expandtab " converts tabs to white space
set shiftwidth=4 " width for autoindents
set laststatus=2 " display the status line always
set statusline=
set statusline+=%(\ [%M%R%H]%)
set statusline+=\
set statusline+=%0.25F
set statusline+=:
set statusline+=%l
set statusline+=:
set statusline+=%L
set statusline+=:
set statusline+=%o
set statusline+=\
set statusline+=%{coc#status()}%{get(b:,'coc_current_function','')}
set statusline+=%=
set statusline+=%{StatuslineMode()}
set statusline+=\
set statusline+=%y
set statusline+=%#warningmsg#
function! StatuslineMode()
let l:mode=mode()
if l:mode==#"n"
return "NORMAL"
elseif l:mode==?"v"
return "VISUAL"
elseif l:mode==#"i"
return "INSERT"
elseif l:mode==#"R"
return "REPLACE"
elseif l:mode==?"s"
return "SELECT"
elseif l:mode==#"t"
return "TERMINAL"
elseif l:mode==#"c"
return "COMMAND"
elseif l:mode==#"!"
return "SHELL"
endif
endfunction
" Key mappings
map ` :NERDTreeToggle<CR>
" movement
nnoremap <C-j> <C-W><C-J>
nnoremap <C-k> <C-W><C-K>
nnoremap <C-l> <C-W><C-L>
nnoremap <C-h> <C-W><C-H>
nnoremap <CR> :noh<CR> "removes highlighting after a search
autocmd FileType go nmap gtj :CocCommand go.tags.add json<cr>
autocmd BufWritePre *.go :call CocAction('runCommand', 'editor.action.organizeImport')
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')
" GoTo code navigation.
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)
nnoremap <silent> <Leader>t :TagbarOpenAutoClose<CR>
let g:tagbar_ctags_bin = '/opt/local/bin/uctags'
" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment