Last active
November 29, 2022 08:29
-
-
Save cmndrsp0ck/ad7ecb691a0f88dbe50493af56712dd6 to your computer and use it in GitHub Desktop.
neovim configuration file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"---------------------------------------------- | |
" Plugin management | |
" | |
" Download vim-plug from the URL below and follow the installation | |
" instructions: | |
" https://github.com/junegunn/vim-plug | |
"---------------------------------------------- | |
call plug#begin('~/.vim/plugged') | |
" Dependencies | |
Plug 'Shougo/neocomplcache' " Depenency for Shougo/neosnippet | |
Plug 'godlygeek/tabular' " This must come before plasticboy/vim-markdown | |
Plug 'tpope/vim-rhubarb' " Depenency for tpope/fugitive | |
" General plugins | |
Plug 'Shougo/denite.nvim' | |
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } | |
Plug 'Shougo/neosnippet' | |
Plug 'Shougo/neosnippet-snippets' " Default snippets for many languages | |
Plug 'bling/vim-airline' | |
Plug 'christoomey/vim-tmux-navigator' | |
Plug 'ctrlpvim/ctrlp.vim' " CtrlP is installed to support tag finding in vim-go | |
Plug 'editorconfig/editorconfig-vim' | |
Plug 'itchyny/calendar.vim' | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
Plug 'majutsushi/tagbar' | |
Plug 'mhinz/vim-signify' | |
Plug 'mileszs/ack.vim' | |
Plug 'neomake/neomake' | |
Plug 'Townk/vim-autoclose' | |
Plug 'rbgrouleff/bclose.vim' | |
Plug 'sbdchd/neoformat' | |
Plug 'scrooloose/nerdcommenter' | |
Plug 'scrooloose/nerdtree' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'sebdah/vim-delve' | |
Plug 'terryma/vim-multiple-cursors' | |
Plug 'tpope/vim-fugitive' | |
Plug 'tpope/vim-surround' | |
Plug 'vimwiki/vimwiki' | |
Plug 'andrewstuart/vim-kubernetes' | |
Plug 'vim-scripts/todo-vim' | |
Plug 'suan/vim-instant-markdown' | |
Plug 'hashivim/vim-vagrant' " Vagrant command shortcuts and filetype set to ruby | |
Plug 'hashivim/vim-consul' " Consul command shortcuts | |
Plug 'hashivim/vim-nomadproject' " Nomad command shortcuts | |
Plug 'hashivim/vim-packer' " Packer command shortcuts | |
Plug 'skorokithakis/pastery.vim' " Pastery pastebin plugin | |
" Vim only plugins | |
if !has('nvim') | |
Plug 'Shougo/vimproc.vim', {'do' : 'make'} " Needed to make sebdah/vim-delve work on Vim | |
Plug 'Shougo/vimshell.vim' " Needed to make sebdah/vim-delve work on Vim | |
endif | |
" Language support | |
Plug 'HerringtonDarkholme/yats.vim' " TypeScript syntax | |
Plug 'aklt/plantuml-syntax' " PlantUML syntax highlighting | |
Plug 'cespare/vim-toml' " toml syntax highlighting | |
Plug 'chr4/nginx.vim' " nginx syntax highlighting | |
Plug 'dag/vim-fish' " Fish syntax highlighting | |
Plug 'digitaltoad/vim-pug' " Pug syntax highlighting | |
Plug 'fatih/vim-go' " Go support | |
Plug 'fishbullet/deoplete-ruby' " Ruby auto completion | |
Plug 'hashivim/vim-terraform' " Terraform syntax highlighting | |
Plug 'kchmck/vim-coffee-script' " CoffeeScript syntax highlighting | |
Plug 'kylef/apiblueprint.vim' " API Blueprint syntax highlighting | |
Plug 'leafgarland/typescript-vim' " TypeScript syntax highlighting | |
Plug 'lifepillar/pgsql.vim' " PostgreSQL syntax highlighting | |
Plug 'mhartington/nvim-typescript', {'do': './install.sh'} " TypeScript auto completion | |
Plug 'mxw/vim-jsx' " JSX syntax highlighting | |
Plug 'nsf/gocode', { 'rtp': 'vim', 'do': '~/.vim/plugged/gocode/vim/symlink.sh' } " Go auto completion | |
Plug 'pangloss/vim-javascript' " JavaScript syntax highlighting | |
Plug 'plasticboy/vim-markdown' " Markdown syntax highlighting | |
Plug 'rodjek/vim-puppet' " Puppet syntax highlighting | |
Plug 'tclh123/vim-thrift' " Thrift syntax highlighting | |
Plug 'zchee/deoplete-go', { 'do': 'make'} " Go auto completion | |
Plug 'zchee/deoplete-jedi' " Go auto completion | |
Plug 'zimbatm/haproxy.vim' " HAProxy syntax highlighting | |
Plug 'python-mode/python-mode' " Python syntax highlighting and linting | |
Plug 'Glench/Vim-Jinja2-Syntax' " Jinja2 templating syntax highlighting | |
" Colorschemes | |
Plug 'NLKNguyen/papercolor-theme' | |
Plug 'altercation/vim-colors-solarized' | |
Plug 'ayu-theme/ayu-vim' | |
Plug 'kaicataldo/material.vim' | |
Plug 'rakr/vim-one' | |
call plug#end() | |
"---------------------------------------------- | |
" General settings | |
"---------------------------------------------- | |
set runtimepath+=~/.vim | |
set packpath+=~/.vim | |
syntax on " syntax highlighting on | |
set number " show line numbers | |
set tabstop=2 " set number of spaces used for tab tabstop, shiftwidth, and expandtab | |
set shiftwidth=2 | |
set expandtab | |
set smartindent " indentation disabled. allowing this to be set by language plugins | |
set autoread " reload file if the file changes on the disk | |
set noshowmode " disable showing mode since powerline will be used | |
set showtabline=2 " Don't show tabs in vim | |
set cursorline " highlight the current line for the cursor | |
set pastetoggle=<F7> | |
set t_Co=256 | |
" Set the leader button | |
let mapleader = ',' | |
" function for line number | |
fun! ToggleLN() | |
if &number == 1 | |
set nonumber | |
else | |
set number | |
endif | |
endfun | |
nnoremap <F3> :call ToggleLN()<cr> | |
" function for colorcolumn | |
fun! ToggleCC() | |
if &cc == '' | |
set cc=80 | |
else | |
set cc= | |
endif | |
endfun | |
nnoremap <F4> :call ToggleCC()<cr> | |
" Toggle todo list | |
nmap <F5> :TODOToggle<cr> | |
" Toggle Tagbar - program outline | |
nmap <F6> :TagbarToggle<cr> | |
" Toggle Line wrap | |
fun! ToggleWrap() | |
if &wrap == 0 | |
set wrap | |
else | |
set nowrap | |
endif | |
endfun | |
nnoremap <F8> :call ToggleWrap()<cr> | |
"---------------------------------------------- | |
" Colors | |
"---------------------------------------------- | |
if (has("nvim")) | |
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > | |
let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
endif | |
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 > | |
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd > | |
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 > | |
if (has("termguicolors")) | |
set termguicolors | |
endif | |
set background=dark | |
" Material colorscheme settings | |
let g:material_theme_style = 'dark' | |
" Ayu colorscheme settings | |
let ayucolor = 'dark' | |
" One colorscheme settings | |
let g:one_allow_italics = 1 | |
" colorscheme ayu | |
colorscheme one | |
" Override the search highlight color with a combination that is easier to | |
" read. The default PaperColor is dark green backgroun with black foreground. | |
" | |
" Reference: | |
" - http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim | |
highlight Search guibg=DeepPink4 guifg=White ctermbg=53 ctermfg=White | |
" Toggle background with <leader>bg | |
map <leader>bg :let &background = (&background == "dark"? "light" : "dark")<cr> | |
"---------------------------------------------- | |
" Searching | |
"---------------------------------------------- | |
set incsearch " move to match as you type the search query | |
set hlsearch " disable search result highlighting | |
if has('nvim') | |
set inccommand=split " enables interactive search and replace | |
endif | |
" Clear search highlights | |
map <leader>c :nohlsearch<cr> | |
" These mappings will make it so that going to the next one in a search will | |
" center on the line it's found in. | |
nnoremap n nzzzv | |
nnoremap N Nzzzv | |
"---------------------------------------------- | |
" Navigation | |
"---------------------------------------------- | |
" Disable arrow keys | |
noremap <Up> <NOP> | |
noremap <Down> <NOP> | |
noremap <Left> <NOP> | |
noremap <Right> <NOP> | |
" Move between buffers with Shift + arrow key... | |
nnoremap <S-Left> :bprevious<cr> | |
nnoremap <S-Right> :bnext<cr> | |
" ... but skip the quickfix when navigating | |
augroup qf | |
autocmd! | |
autocmd FileType qf set nobuflisted | |
augroup END | |
" Fix some common typos | |
cnoreabbrev W! w! | |
cnoreabbrev Q! q! | |
cnoreabbrev Qall! qall! | |
cnoreabbrev Wq wq | |
cnoreabbrev Wa wa | |
cnoreabbrev wQ wq | |
cnoreabbrev WQ wq | |
cnoreabbrev W w | |
cnoreabbrev Q q | |
cnoreabbrev Qall qall | |
"---------------------------------------------- | |
" Splits | |
"---------------------------------------------- | |
" Create horizontal splits below the current window | |
set splitbelow | |
set splitright | |
" Creating splits | |
nnoremap <leader>v :vsplit<cr> | |
nnoremap <leader>h :split<cr> | |
" Closing splits | |
nnoremap <leader>q :close<cr> | |
"---------------------------------------------- | |
" Plugin: suan/vim-instant-markdown | |
"---------------------------------------------- | |
let g:instant_markdown_autostart = 0 | |
map <leader>mp :InstantMarkdownPreview<CR> | |
"---------------------------------------------- | |
" Plugin: bling/vim-airline | |
"---------------------------------------------- | |
" Show status bar by default. | |
set laststatus=2 | |
" Enable top tabline. | |
let g:airline#extensions#tabline#enabled = 1 | |
" Disable showing tabs in the tabline. This will ensure that the buffers are | |
" what is shown in the tabline at all times. | |
let g:airline#extensions#tabline#show_tabs = 0 | |
" Enable powerline fonts. | |
let g:airline_powerline_fonts = 0 | |
" Explicitly define some symbols that did not work well for me in Linux. | |
if !exists('g:airline_symbols') | |
let g:airline_symbols = {} | |
endif | |
let g:airline_symbols.branch = '' | |
let g:airline_symbols.maxlinenr = '' | |
"---------------------------------------------- | |
" Plugin: plasticboy/vim-markdown | |
"---------------------------------------------- | |
" Disable folding | |
let g:vim_markdown_folding_disabled = 1 | |
" Auto shrink the TOC, so that it won't take up 50% of the screen | |
let g:vim_markdown_toc_autofit = 1 | |
" execute pathogen#infect() | |
filetype plugin indent on | |
"---------------------------------------------- | |
" Plugin: 'python-mode/python-mode' | |
"---------------------------------------------- | |
let pymode_options_colorcolumn = 0 | |
let g:python_mode = 'python3' | |
let g:pymode_folding = 0 | |
"---------------------------------------------- | |
" Plugin: 'terryma/vim-multiple-cursors' | |
"---------------------------------------------- | |
let g:multi_cursor_next_key='<C-n>' | |
let g:multi_cursor_skip_key='<C-b>' | |
"---------------------------------------------- | |
" Plugin: zchee/deoplete-go | |
"---------------------------------------------- | |
" Enable completing of go pointers | |
let g:deoplete#sources#go#pointer = 1 | |
" Enable autocomplete of unimported packages | |
let g:deoplete#sources#go#unimported_packages = 0 | |
"---------------------------------------------- | |
" Language: Golang | |
"---------------------------------------------- | |
au FileType go set noexpandtab | |
au FileType go set shiftwidth=4 | |
au FileType go set softtabstop=4 | |
au FileType go set tabstop=4 | |
" Mappings | |
au FileType go nmap <F8> :GoMetaLinter<cr> | |
au FileType go nmap <F9> :GoCoverageToggle -short<cr> | |
au FileType go nmap <F10> :GoTest -short<cr> | |
au FileType go nmap <F12> <Plug>(go-def) | |
au Filetype go nmap <leader>ga <Plug>(go-alternate-edit) | |
au Filetype go nmap <leader>gah <Plug>(go-alternate-split) | |
au Filetype go nmap <leader>gav <Plug>(go-alternate-vertical) | |
au FileType go nmap <leader>gt :GoDeclsDir<cr> | |
au FileType go nmap <leader>gc <Plug>(go-coverage-toggle) | |
au FileType go nmap <leader>gd <Plug>(go-def) | |
au FileType go nmap <leader>gdv <Plug>(go-def-vertical) | |
au FileType go nmap <leader>gdh <Plug>(go-def-split) | |
au FileType go nmap <leader>gD <Plug>(go-doc) | |
au FileType go nmap <leader>gDv <Plug>(go-doc-vertical) | |
" Run goimports when running gofmt | |
let g:go_fmt_command = "goimports" | |
" Use gopls for autocomplete | |
let g:go_def_mode = "gopls" | |
" enable completion | |
if has('nvim') | |
" Enable deoplete on startup | |
let g:deoplete#enable_at_startup = 1 | |
endif | |
" Disable deoplete when in multi cursor mode | |
function! Multiple_cursors_before() | |
let b:deoplete_disable_auto_complete = 1 | |
endfunction | |
function! Multiple_cursors_after() | |
let b:deoplete_disable_auto_complete = 0 | |
endfunction | |
" Set neosnippet as snippet engine | |
let g:go_snippet_engine = "neosnippet" | |
" Enable syntax highlighting per default | |
let g:go_highlight_types = 1 | |
let g:go_highlight_fields = 1 | |
let g:go_highlight_functions = 1 | |
let g:go_highlight_methods = 1 | |
let g:go_highlight_structs = 1 | |
let g:go_highlight_operators = 1 | |
let g:go_highlight_build_constraints = 1 | |
let g:go_highlight_extra_types = 1 | |
" Show the progress when running :GoCoverage | |
let g:go_echo_command_info = 1 | |
" Show type information | |
let g:go_auto_type_info = 1 | |
" Highlight variable uses | |
let g:go_auto_sameids = 1 | |
" Fix for location list when vim-go is used together with Syntastic | |
let g:go_list_type = "quickfix" | |
" Add the failing test name to the output of :GoTest | |
let g:go_test_show_name = 1 | |
" gometalinter configuration | |
let g:go_metalinter_command = "" | |
let g:go_metalinter_deadline = "5s" | |
let g:go_metalinter_enabled = [ | |
\ 'deadcode', | |
\ 'gas', | |
\ 'goconst', | |
\ 'gocyclo', | |
\ 'golint', | |
\ 'gosimple', | |
\ 'ineffassign', | |
\ 'vet', | |
\ 'vetshadow' | |
\] | |
" Set whether the JSON tags should be snakecase or camelcase. | |
let g:go_addtags_transform = "snakecase" | |
" neomake configuration for Go. | |
let g:neomake_go_enabled_makers = [ 'go', 'gometalinter' ] | |
let g:neomake_go_gometalinter_maker = { | |
\ 'args': [ | |
\ '--tests', | |
\ '--enable-gc', | |
\ '--concurrency=3', | |
\ '--fast', | |
\ '-D', 'aligncheck', | |
\ '-D', 'dupl', | |
\ '-D', 'gocyclo', | |
\ '-D', 'gotype', | |
\ '-E', 'misspell', | |
\ '-E', 'unused', | |
\ '%:p:h', | |
\ ], | |
\ 'append_file': 0, | |
\ 'errorformat': | |
\ '%E%f:%l:%c:%trror: %m,' . | |
\ '%W%f:%l:%c:%tarning: %m,' . | |
\ '%E%f:%l::%trror: %m,' . | |
\ '%W%f:%l::%tarning: %m' | |
\ } | |
"---------------------------------------------- | |
" Language: Bash | |
"---------------------------------------------- | |
au FileType sh set noexpandtab | |
au FileType sh set shiftwidth=2 | |
au FileType sh set softtabstop=2 | |
au FileType sh set tabstop=2 | |
"---------------------------------------------- | |
" Language: JavaScript | |
"---------------------------------------------- | |
au FileType javascript set expandtab | |
au FileType javascript set shiftwidth=2 | |
au FileType javascript set softtabstop=2 | |
au FileType javascript set tabstop=2 | |
"---------------------------------------------- | |
" Language: JSON | |
"---------------------------------------------- | |
au FileType json set expandtab | |
au FileType json set shiftwidth=2 | |
au FileType json set softtabstop=2 | |
au FileType json set tabstop=2 | |
"---------------------------------------------- | |
" Language: Make | |
"---------------------------------------------- | |
au FileType make set noexpandtab | |
au FileType make set shiftwidth=2 | |
au FileType make set softtabstop=2 | |
au FileType make set tabstop=2 | |
"---------------------------------------------- | |
" Language: Markdown | |
"---------------------------------------------- | |
au FileType markdown setlocal spell | |
au FileType markdown set expandtab | |
au FileType markdown set shiftwidth=4 | |
au FileType markdown set softtabstop=4 | |
au FileType markdown set tabstop=4 | |
au FileType markdown set syntax=markdown | |
"---------------------------------------------- | |
" Language: Python | |
"---------------------------------------------- | |
au FileType python set expandtab | |
au FileType python set shiftwidth=4 | |
au FileType python set softtabstop=4 | |
au FileType python set tabstop=4 | |
"---------------------------------------------- | |
" Language: Ruby | |
"---------------------------------------------- | |
au FileType ruby set expandtab | |
au FileType ruby set shiftwidth=2 | |
au FileType ruby set softtabstop=2 | |
au FileType ruby set tabstop=2 | |
" Enable neomake for linting. | |
"au FileType ruby autocmd BufWritePost * Neomake | |
"---------------------------------------------- | |
" Language: SQL | |
"---------------------------------------------- | |
au FileType sql set expandtab | |
au FileType sql set shiftwidth=2 | |
au FileType sql set softtabstop=2 | |
au FileType sql set tabstop=2 | |
"---------------------------------------------- | |
" Language: TOML | |
"---------------------------------------------- | |
au FileType toml set expandtab | |
au FileType toml set shiftwidth=2 | |
au FileType toml set softtabstop=2 | |
au FileType toml set tabstop=2 | |
"---------------------------------------------- | |
" Language: YAML | |
"---------------------------------------------- | |
au FileType yaml set expandtab | |
au FileType yaml set shiftwidth=2 | |
au FileType yaml set softtabstop=2 | |
au FileType yaml set tabstop=2 | |
"---------------------------------------------- | |
" Language: C++ | |
"---------------------------------------------- | |
au FileType cpp set expandtab | |
au FileType cpp set shiftwidth=4 | |
au FileType cpp set softtabstop=4 | |
au FileType cpp set tabstop=4 | |
"---------------------------------------------- | |
" Language: CSS | |
"---------------------------------------------- | |
au FileType css set expandtab | |
au FileType css set shiftwidth=2 | |
au FileType css set softtabstop=2 | |
au FileType css set tabstop=2 | |
"---------------------------------------------- | |
" NERDTree settings | |
"---------------------------------------------- | |
" set keymap to toggle nerd tree explorer | |
map <C-i> :NERDTreeToggle<CR> | |
" Open NERDTree if a directory is open with VIM | |
autocmd StdinReadPre * let s:std_in=1 | |
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif | |
" close vim if the only open window is NERDTree | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
let g:NERDTreeShowIgnoredStatus = 1 | |
let g:NERDTreeIndicatorMapCustom = { | |
\ "Modified" : "✹", | |
\ "Staged" : "✚", | |
\ "Untracked" : "✭", | |
\ "Renamed" : "➜", | |
\ "Unmerged" : "═", | |
\ "Deleted" : "✖", | |
\ "Dirty" : "✗", | |
\ "Clean" : "✔︎", | |
\ 'Ignored' : '☒', | |
\ "Unknown" : "?" | |
\ } | |
" Files to ignore | |
let NERDTreeIgnore = [ | |
\ '\~$', | |
\ '\.pyc$', | |
\ '^\.DS_Store$', | |
\ '^node_modules$', | |
\ '^.ropeproject$', | |
\ '^__pycache__$' | |
\] | |
" Show hidden files by default. | |
let NERDTreeShowHidden = 1 | |
" Allow NERDTree to change session root. | |
let g:NERDTreeChDirMode = 2 | |
"---------------------------------------------- | |
" Plugin: Shougo/neosnippet | |
"---------------------------------------------- | |
" Disable the default snippets (needed since we do not install | |
" Shougo/neosnippet-snippets). | |
" | |
" Below you can disable default snippets for specific languages. If you set the | |
" language to _ it sets the default for all languages. | |
let g:neosnippet#disable_runtime_snippets = { | |
\ 'go': 1 | |
\} | |
" Keybindings | |
imap <C-k> <Plug>(neosnippet_expand_or_jump) | |
smap <C-k> <Plug>(neosnippet_expand_or_jump) | |
xmap <C-k> <Plug>(neosnippet_expand_target) | |
" Set the path to our snippets | |
let g:neosnippet#snippets_directory='~/.config/nvim/snippets' | |
" Set key map for markdown live preview | |
" nmap <C-p> :LivedownToggle<CR> | |
"---------------------------------------------- | |
" Plugin: skorokithakis/pastery.vim | |
"---------------------------------------------- | |
let g:pastery_apikey="" | |
let g:pastery_copy_to_clipboard=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment