|
|
|
"**************************
|
|
|
|
"Defaults
|
|
|
|
|
|
|
|
set exrc
|
|
|
|
set nohlsearch
|
|
|
|
set incsearch
|
|
|
|
set relativenumber
|
|
|
|
set number
|
|
|
|
set encoding=utf-8
|
|
|
|
set colorcolumn=81
|
|
|
|
highlight ColorColumn ctermbg=lightgrey guibg=lightgrey
|
|
|
|
|
|
|
|
set noswapfile
|
|
|
|
set nobackup
|
|
|
|
set undodir=~/.vim/undodir
|
|
|
|
set undofile
|
|
|
|
|
|
|
|
"Tabbing
|
|
|
|
set autoindent tabstop=4 shiftwidth=4
|
|
|
|
|
|
|
|
"File specific
|
|
|
|
|
|
|
|
"**************************
|
|
|
|
"Commands
|
|
|
|
|
|
|
|
command JsonFormat :%!python3 -m json.tool
|
|
|
|
|
|
|
|
"**************************
|
|
|
|
"Key Remaps
|
|
|
|
|
|
|
|
let mapleader = " "
|
|
|
|
|
|
|
|
"Window management
|
|
|
|
nnoremap <Leader>w <C-w>
|
|
|
|
nnoremap <Leader>ws :vsp<cr>
|
|
|
|
nnoremap <Leader>wi :sp<cr>
|
|
|
|
nnoremap <Leader>wt :tabnew<cr>
|
|
|
|
|
|
|
|
"Vim stuff
|
|
|
|
nnoremap <Leader>fs :w<cr>
|
|
|
|
nnoremap <Leader>fer :source ~/.config/nvim/init.vim<cr>
|
|
|
|
nnoremap <Leader>r :<C-u>registers<CR>:normal! "p<Left>
|
|
|
|
nnoremap <Leader>p :set paste!<cr>
|
|
|
|
nnoremap <Leader>c "+
|
|
|
|
vnoremap <Leader>c "+
|
|
|
|
|
|
|
|
"**************************
|
|
|
|
" Bracket completion
|
|
|
|
|
|
|
|
inoremap {<cr> {<cr>}<c-o>O
|
|
|
|
inoremap [<space> []<left>
|
|
|
|
inoremap {<space> {}<left>
|
|
|
|
inoremap {{<space> {{<space><space>}}<left><left><left>
|
|
|
|
inoremap ({<cr> ({<cr>})<c-o>O<tab>
|
|
|
|
inoremap (<space> ()<left>
|
|
|
|
inoremap {)<cr> {<cr>});<c-o>O
|
|
|
|
|
|
|
|
"**************************
|
|
|
|
" Plugins
|
|
|
|
|
|
|
|
call plug#begin(expand('~/.vim/plugged'))
|
|
|
|
Plug 'editorconfig/editorconfig-vim'
|
|
|
|
Plug 'alvan/vim-closetag'
|
|
|
|
Plug 'tpope/vim-surround'
|
|
|
|
Plug 'tpope/vim-commentary'
|
|
|
|
Plug 'tpope/vim-fugitive'
|
|
|
|
Plug 'jonsmithers/vim-html-template-literals', { 'branch': 'dev' }
|
|
|
|
Plug 'godlygeek/tabular'
|
|
|
|
Plug 'plasticboy/vim-markdown'
|
|
|
|
Plug 'yuezk/vim-js'
|
|
|
|
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
|
|
|
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
|
|
|
|
Plug 'nvim-lua/plenary.nvim'
|
|
|
|
Plug 'nvim-telescope/telescope.nvim'
|
|
|
|
Plug 'kchmck/vim-coffee-script'
|
|
|
|
call plug#end()
|
|
|
|
|
|
|
|
"**************************
|
|
|
|
" Plugin Configs
|
|
|
|
|
|
|
|
"Telescope
|
|
|
|
nnoremap <leader>ff <cmd>Telescope find_files<cr>
|
|
|
|
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
|
|
|
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
|
|
|
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
|
|
|
|
|
|
|
"Markdown
|
|
|
|
autocmd FileType markdown set colorcolumn=
|
|
|
|
|
|
|
|
"**************************
|
|
|
|
" COC
|
|
|
|
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)
|
|
|
|
nmap <Leader>rn <Plug>(coc-rename)
|
|
|
|
|
|
|
|
"**************************
|
|
|
|
" Languages
|
|
|
|
|
|
|
|
" Go
|
|
|
|
autocmd BufWritePre *.go :silent call CocAction('runCommand', 'editor.action.organizeImport')
|
|
|
|
|
|
|
|
" C/C++
|
|
|
|
autocmd BufWritePre *.h,*.hpp,*.c,*.cpp :call FormatBuffer()
|