Skip to content

Instantly share code, notes, and snippets.

@dhollinger
Last active August 23, 2020 17:24
Show Gist options
  • Save dhollinger/a22f60617f02c6d6c4968ca0c3fe88e6 to your computer and use it in GitHub Desktop.
Save dhollinger/a22f60617f02c6d6c4968ca0c3fe88e6 to your computer and use it in GitHub Desktop.
Neovim configuration
{
"languageserver": {
"puppet": {
"command": "ruby",
"args": ["/home/dhollinger/workspace/ruby/puppet-editor-services/puppet-languageserver","--stdio","--puppet-settings=--moduledir,/home/dhollinger/.puppetlabs/etc/code/modules"],
"cwd": "/home/dhollinger/workspace/ruby/puppet-editor-services",
"filetypes": ["puppet"],
"rootPatterns": [".git/", "metadata.json"]
},
"golang": {
"command": "gopls",
"filetypes": ["go"],
"rootPatterns": ["go.mod"]
},
"bash": {
"command": "bash-language-server",
"args": ["start"],
"filetypes": ["sh"],
"ignoredRootPaths": ["~"]
},
"dockerfile": {
"command": "docker-langserver",
"filetypes": ["dockerfile"],
"args": ["--stdio"]
}
}
}
call plug#begin('~/.config/nvim/plugged')
" My Default Plugs
Plug 'airblade/vim-gitgutter'
Plug 'altercation/vim-colors-solarized'
Plug 'bitfield/vim-gitgo'
Plug 'chase/vim-ansible-yaml'
Plug 'christoomey/vim-tmux-navigator'
Plug 'dietsche/vim-lastplace'
Plug 'dracula/vim'
Plug 'easymotion/vim-easymotion'
Plug 'editorconfig/editorconfig-vim'
Plug 'edkolev/tmuxline.vim'
Plug 'ekalinin/Dockerfile.vim'
Plug 'elzr/vim-json'
Plug 'fatih/vim-go'
Plug 'fgsch/vim-varnish'
Plug 'godlygeek/tabular'
Plug 'gregsexton/gitv'
Plug 'honza/vim-snippets'
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() } }
Plug 'idanarye/vim-merginal'
Plug 'itchyny/lightline.vim'
Plug 'jacoborus/tender.vim'
Plug 'jez/vim-github-hub'
Plug 'jiangmiao/auto-pairs'
Plug 'joshdick/onedark.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'junegunn/vim-easy-align'
Plug 'keith/rspec.vim'
Plug 'aonemd/kuroi.vim'
Plug 'liuchengxu/space-vim-dark'
Plug 'majutsushi/tagbar'
Plug 'marciomazza/vim-brogrammer-theme'
Plug 'mattn/emmet-vim'
Plug 'mattn/webapi-vim'
Plug 'mrk21/yaml-vim'
Plug 'nanotech/jellybeans.vim'
Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}}
Plug 'NLKNguyen/papercolor-theme'
Plug 'powerline/fonts'
Plug 'rafi/vim-unite-issue'
Plug 'rodjek/vim-puppet'
Plug 'rudexi/vim-epp'
Plug 'ryanoasis/vim-devicons'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'sebdah/vim-delve'
Plug 'sickill/vim-monokai'
Plug 'sjl/badwolf'
Plug 'terryma/vim-multiple-cursors'
Plug 'tomasiser/vim-code-dark'
Plug 'tpope/vim-bundler'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rails'
Plug 'twerth/ir_black'
Plug 'tyru/open-browser.vim'
Plug 'vim-ruby/vim-ruby'
Plug 'vimlab/split-term.vim'
Plug 'xuyuanp/nerdtree-git-plugin'
call plug#end()
" General Settings
set background=dark
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
set termguicolors
set t_Co=256
set t_ut=
colorscheme kuroi
syntax enable
set number relativenumber
set splitbelow
set splitright
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
autocmd BufEnter,FocusGained,InsertLeave NERD_* set norelativenumber nonumber
augroup END
set mouse=a
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+,space:.
set list
" Ensure ASDF python is loaded correctly
let g:python_host_prog = '/home/dhollinger/.asdf/shims/python2'
let g:python3_host_prog = '/home/dhollinger/.asdf/shims/python3'
" Map leader to comma
noremap <Space> :
let mapleader=","
" Map Coc.vim settings
nnoremap <silent> <space>w :exe 'CocList -I --normal --input='.expand('<cword>').' words'<CR>
nnoremap <silent> <space>r :exe 'CocList -I --normal --input='.expand('<cword>').' symbols'<CR>
nnoremap <silent> <space>D :call CocActionAsync('jumpDefinition')<CR>
nnoremap <silent> <space>DV :call CocActionAsync('jumpDefinition', 'vsplit')<CR>
nnoremap <silent> <space>DS :call CocActionAsync('jumpDefinition', 'split')<CR>
nnoremap <silent> <space>DT :call CocActionAsync('jumpDefinition', 'tabe')<CR>
nnoremap <silent> <space>I :call CocActionAsync('jumpDeclaration')<CR>
" Map tab navigation
nnoremap <silent> <space>t :tabn<CR>
nnoremap <silent> <space>T :tabp<CR>
noremap <Leader>f :Files<CR>
noremap <Leader>F :Files %:p:h<CR>
noremap <Leader>v :GFiles<CR>
" TODO I'd like to merge the history / buffers list
noremap <Leader>b :Buffers<CR>
noremap <Leader>h :History<CR>
noremap <Leader>gc :Commits<CR>
noremap <Leader>gb :BCommits<CR>
noremap <F1> :Helptags<CR>
" FZF configuration using ripgrep.
" --column: Show column number
" --line-number: Show line number
" --no-heading: Do not show file headings in results
" --fixed-strings: Search term as a literal string
" --ignore-case: Case insensitive search
" --no-ignore: Do not respect .gitignore, etc...
" --hidden: Search hidden files and folders
" --follow: Follow symlinks
" --glob: Additional conditions for search (in this case ignore everything in the .git/ folder)
" --color: Search color options
command! -bang -nargs=* Rg call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>), 1, <bang>0)
let g:fzf_layout = { 'window': 'call FloatingFZF()' }
function! FloatingFZF()
let buf = nvim_create_buf(v:false, v:true)
call setbufvar(buf, '&signcolumn', 'no')
let height = float2nr(50)
let width = float2nr(160)
let horizontal = float2nr((&columns - width) / 2)
let vertical = 1
let opts = {
\ 'relative': 'editor',
\ 'row': vertical,
\ 'col': horizontal,
\ 'width': width,
\ 'height': height,
\ 'style': 'minimal'
\ }
call nvim_open_win(buf, v:true, opts)
endfunction
noremap <Leader>/ :FZF<CR>
noremap <Leader>p :Ag<CR>
" TMUX theme
let g:tmuxline_preset = {
\'a' : ['#(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD)', '#S'],
\'b' : ['#I', '#W'],
\'y' : ['#{prefix_highlight}', 'Online: #{online_status}', '%a %h-%d %H:%M'],
\'z' : '#H'}
let g:tmuxline_powerline_separators = 0
" Lightline settings
function! CocCurrentFunction()
return get(b:, 'coc_current_function', '')
endfunction
let g:lightline = {
\ 'colorscheme': 'powerline',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'cocstatus', 'currentfunction', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'cocstatus': 'coc#status',
\ 'currentfunction': 'CocCurrentFunction'
\ },
\ }
" Vim Multiple Cursors mappings
let g:multi_cursor_use_default_mapping=0
" Default mapping
let g:multi_cursor_start_word_key = '<C-A-n>'
let g:multi_cursor_select_all_word_key = '<A-n>'
let g:multi_cursor_start_key = 'g<C-A-n>'
let g:multi_cursor_select_all_key = 'g<A-n>'
let g:multi_cursor_next_key = '<C-A-n>'
let g:multi_cursor_prev_key = '<C-p>'
let g:multi_cursor_skip_key = '<C-x>'
let g:multi_cursor_quit_key = '<Esc>'
" Status line settings
set statusline+=%#warningmsg#
set statusline+=%{coc#status()}
set statusline+=%*
" Map buffer delete to CTRL-D
map <silent> <C-D> :bd<CR>
" Map close to CTRL-C
map <silent> <C-C> :close<CR>
" Map gitv to F6
map <silent> <F6> :Gitv<CR>
" Map Merginal to F7
map <silent> <F7> :MerginalToggle<CR>
" Map NERDTree to F5
map <silent> <F5> :NERDTreeToggle<CR>
" NerdTree devicons colors
autocmd BufEnter * if bufname('#') =~# "^NERD_tree_" && winnr('$') > 1 | b# | endif
let NERDTreeShowHidden=1
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
hi Directory guifg=none ctermfg=none
autocmd filetype nerdtree highlight ruby_icon ctermbg=none ctermfg=Red guifg=#cc0000
autocmd filetype nerdtree highlight html_icon ctermbg=none ctermfg=Yellow guifg=#e59400
autocmd filetype nerdtree highlight go_icon ctermbg=none ctermfg=Blue guifg=#6bb8f2
autocmd filetype nerdtree highlight node_modules_icon ctermbg=none ctermfg=Green guifg=#68a063
autocmd filetype nerdtree highlight js_icon ctermbg=none ctermfg=Yellow guifg=#ffff4c
autocmd filetype nerdtree highlight md_icon ctermbg=none ctermfg=Blue guifg=#6bb8f2
autocmd filetype nerdtree highlight docker_icon ctermbg=none ctermfg=Blue guifg=#6bb8f2
autocmd filetype nerdtree highlight heroku_icon ctermbg=none ctermfg=Blue guifg=#6762a6
" if you are using another syn highlight for a given line (e.g.
" NERDTreeHighlightFile) need to give that name in the 'containedin' for this
" other highlight to work with it
autocmd filetype nerdtree syn match ruby_icon ## containedin=NERDTreeFile,ruby
autocmd filetype nerdtree syn match node_modules_icon ## containedin=NERDTreeFile,node_modules
autocmd filetype nerdtree syn match html_icon ## containedin=NERDTreeFile,html
autocmd filetype nerdtree syn match go_icon ## containedin=NERDTreeFile
autocmd filetype nerdtree syn match js_icon ## containedin=NERDTreeFile
autocmd filetype nerdtree syn match md_icon ## containedin=NERDTreeFile
autocmd filetype nerdtree syn match docker_icon ## containedin=NERDTreeFile
autocmd filetype nerdtree syn match heroku_icon ## containedin=NERDTreeFile
" Map TagBarToggle to CTRL-T
map <silent> <F8> :TagbarToggle<CR>
" Map Terminal to CTRL-`
map <Leader>` :Term<CR>
" Setup Git Gutter and Syntastic
let g:gitgutter_realtime = 1
" Set Tabs
set tabstop=4
set softtabstop=4
set expandtab
" Set Folding Options
set foldenable
set foldlevelstart=10
set foldnestmax=10
nnoremap <space> za
set foldmethod=syntax
" Additional Options
set lazyredraw
set showmatch
" Ripper tags
if executable('ripper-tags')
let g:tagbar_type_ruby = {
\ 'kinds' : ['m:modules',
\ 'c:classes',
\ 'C:constants',
\ 'F:singleton methods',
\ 'f:methods',
\ 'a:aliases'],
\ 'kind2scope' : { 'c' : 'class',
\ 'm' : 'class' },
\ 'scope2kind' : { 'class' : 'c' },
\ 'ctagsbin' : 'ripper-tags',
\ 'ctagsargs' : ['-f', '-']
\ }
endif
let g:tagbar_type_puppet = {
\ 'ctagstype': 'puppet',
\ 'kinds': [
\'c:class',
\'s:site',
\'n:node',
\'d:definition'
\]
\}
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
" Golang syntax highlighting
let g:go_highlight_build_constraints = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_function_parameters = 1
let g:go_highlight_methods = 1
let g:go_highlight_operators = 1
let g:go_highlight_structs = 1
let g:go_highlight_types = 1
let g:go_highlight_variable_assignments = 1
let g:go_highlight_variable_declarations = 1
let g:go_auto_sameids = 1
let g:go_addtags_transform = "snakecase"
let g:go_fmt_fail_silently = 0
" Config Groups
augroup configgroup
autocmd!
autocmd VimEnter * highlight clear SignColumn
autocmd FileType go setlocal tabstop=4
autocmd FileType go setlocal shiftwidth=4
autocmd FileType go setlocal softtabstop=4
autocmd FileType go setlocal noexpandtab
autocmd FileType ruby setlocal tabstop=2
autocmd FileType ruby setlocal shiftwidth=2
autocmd FileType ruby setlocal softtabstop=2
autocmd FileType ruby setlocal commentstring=#\ %s
autocmd BufNewFile,BufRead *.pp set syntax=puppet
autocmd FileType puppet setlocal tabstop=2
autocmd FileType puppet setlocal shiftwidth=2
autocmd FileType puppet setlocal softtabstop=2
autocmd FileType puppet setlocal expandtab
autocmd FileType puppet setlocal commentstring=#\ %s
autocmd FileType python setlocal tabstop=4
autocmd FileType python setlocal shiftwidth=4
autocmd FileType python setlocal softtabstop=4
autocmd FileType python setlocal expandtab
autocmd FileType python setlocal commentstring=#\ %s
autocmd BufEnter *.cls setlocal filetype=java
autocmd BufEnter *.jsx setlocal tabstop=2
autocmd BufEnter *.jsx setlocal shiftwidth=2
autocmd BufEnter *.jsx setlocal softtabstop=2
autocmd BufEnter *.jsx setlocal expandtab
autocmd BufEnter *.json setlocal filetype=json
autocmd BufEnter *.json setlocal tabstop=2
autocmd BufEnter *.json setlocal shiftwidth=2
autocmd BufEnter *.json setlocal softtabstop=2
autocmd BufEnter *.json setlocal expandtab
autocmd BufEnter *.zsh-theme setlocal filetype=zsh
autocmd BufEnter Makefile setlocal noexpandtab
autocmd BufEnter *.sh setlocal tabstop=4
autocmd BufEnter *.sh setlocal shiftwidth=4
autocmd BufEnter *.sh setlocal softtabstop=4
augroup END
if &term =~ '256color'
" disable Background Color Erase (BCE)
set t_ut=
endif
highlight Comment cterm=italic gui=italic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment