2019-03-13 14:08:39 +00:00
|
|
|
" defines plugin directory
|
2019-03-04 10:47:17 +00:00
|
|
|
" Install plugins from vim with :PlugInstall
|
|
|
|
call plug#begin('~/.local/share/nvim/plugged')
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
" Base
|
2019-03-04 10:47:17 +00:00
|
|
|
Plug 'tpope/vim-sensible'
|
2019-03-15 15:26:57 +00:00
|
|
|
Plug 'christoomey/vim-tmux-navigator' " add seamless movement between vim and tmux
|
2019-03-13 14:08:39 +00:00
|
|
|
|
2019-03-17 18:45:29 +00:00
|
|
|
" Workflow
|
|
|
|
Plug 'tpope/vim-commentary' " easily toggle comments for lines, paragrapgs etc
|
|
|
|
Plug 'jiangmiao/auto-pairs' " Auto close brackets and ''
|
|
|
|
|
2019-03-13 17:01:53 +00:00
|
|
|
" Ecosystem
|
|
|
|
" Plug 'tpope/vim-fugitive' - Will have to take a closer look some other time
|
2019-03-17 18:45:29 +00:00
|
|
|
Plug 'scrooloose/nerdtree' " directory thingy - perhaps replace it with something more efficient
|
|
|
|
Plug 'Yggdroot/LeaderF' " fuzzy matcher, apparently faster than fzf, ctrlp, unit, denite
|
2019-03-13 17:01:53 +00:00
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
" Language Integration
|
2019-03-17 18:45:29 +00:00
|
|
|
Plug 'sheerun/vim-polyglot' " syntax plugins for almost every language
|
2019-03-09 20:27:14 +00:00
|
|
|
Plug 'stephpy/vim-yaml'
|
2019-03-17 18:45:29 +00:00
|
|
|
Plug 'mhartington/nvim-typescript', {'do': './install.sh'}
|
|
|
|
|
|
|
|
" HTML Workflow
|
|
|
|
Plug 'valloric/matchtagalways'
|
|
|
|
Plug 'alvan/vim-closetag'
|
|
|
|
|
|
|
|
" For async completion
|
|
|
|
Plug 'Shougo/deoplete.nvim' " automatic suggestions, can also perhaps be changed for newer plugs
|
|
|
|
Plug 'w0rp/ale' " asynchronous linting - might be superseded by lsp or coc.nvim at some point
|
2019-03-04 10:47:17 +00:00
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
" Design
|
|
|
|
Plug 'vim-airline/vim-airline'
|
|
|
|
Plug 'vim-airline/vim-airline-themes'
|
2019-03-13 16:18:47 +00:00
|
|
|
Plug 'edkolev/tmuxline.vim'
|
2019-03-13 14:08:39 +00:00
|
|
|
|
|
|
|
" Colorschemes
|
|
|
|
Plug 'Nequo/vim-allomancer'
|
|
|
|
|
2019-03-04 10:47:17 +00:00
|
|
|
call plug#end()
|
2019-03-09 20:27:14 +00:00
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
" PLUGIN CONFIGURATION
|
|
|
|
let g:airline_powerline_fonts=1
|
|
|
|
let g:airline_theme='raven'
|
2019-03-13 16:18:47 +00:00
|
|
|
colorscheme allomancer
|
2019-03-13 17:01:53 +00:00
|
|
|
|
|
|
|
" disable automatically refreshing the mux statusbar since it breaks tmux
|
|
|
|
" prefix highlighting. Instead, when changing vim statusbar just create
|
|
|
|
" snapshot with :TmuxlineSnapshot file and stick it into tmux config manually
|
|
|
|
let g:airline#extensions#tmuxline#enabled = 0
|
2019-03-13 16:18:47 +00:00
|
|
|
" custom preset with left-justified window list
|
|
|
|
let g:tmuxline_preset = {
|
|
|
|
\'a' : '#S',
|
|
|
|
\'b' : '#(whoami)',
|
|
|
|
\'c' : '#I:#P',
|
|
|
|
\'win' : '#I #W',
|
|
|
|
\'cwin' : [' ', '#I #W'],
|
|
|
|
\'x' : '#{prefix_highlight} %H:%M:%S',
|
|
|
|
\'y' : '%d-%b-%y',
|
|
|
|
\'z' : '#H',
|
|
|
|
\'options' : {}}
|
2019-03-09 20:27:14 +00:00
|
|
|
|
2019-03-15 15:26:57 +00:00
|
|
|
" automatically save the current buffer when navigating away from vim
|
|
|
|
let g:tmux_navigator_save_on_switch = 1
|
|
|
|
|
2019-03-17 18:45:29 +00:00
|
|
|
" enable deoplete at startup
|
|
|
|
let g:deoplete#enable_at_startup = 1
|
|
|
|
let g:deoplete#enable_ignore_case = 1
|
|
|
|
let g:deoplete#enable_smart_case = 1
|
|
|
|
let g:deoplete#enable_camel_case = 1
|
|
|
|
let g:deoplete#enable_refresh_always = 1
|
|
|
|
let g:deoplete#max_abbr_width = 0
|
|
|
|
let g:deoplete#max_menu_width = 0
|
|
|
|
let g:deoplete#omni#input_patterns = get(g:,'deoplete#omni#input_patterns',{})
|
|
|
|
|
|
|
|
let g:ale_fix_on_save = 1
|
|
|
|
let g:ale_fixers = {
|
|
|
|
\'javascipt': ['eslint', 'prettier'],
|
|
|
|
\'html': ['tidy','prettier'],
|
|
|
|
\'typescript': ['prettier','tslint'],
|
|
|
|
\'*': ['remove_trailing_lines', 'trim_whitespace'],
|
|
|
|
\}
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
" VIM SETTINGS
|
|
|
|
" set truecolor (neovim)
|
|
|
|
set termguicolors
|
|
|
|
|
|
|
|
" many of these come from
|
|
|
|
" http://stevelosh.com/blog/2010/09/coming-home-to-vim/
|
2019-03-09 20:27:14 +00:00
|
|
|
|
|
|
|
" sets tabs to be 4 characters, expanded into spaces, but still removable with
|
|
|
|
" one press of backspace.
|
|
|
|
" great explanation: http://vimcasts.org/transcripts/2/en/
|
2019-03-17 18:45:29 +00:00
|
|
|
set tabstop=2
|
|
|
|
set shiftwidth=2
|
|
|
|
set softtabstop=2
|
2019-03-09 20:27:14 +00:00
|
|
|
set expandtab
|
|
|
|
|
|
|
|
" shows linenumbers relative to the one you are on, for easy movement and
|
|
|
|
" dNUMBERd deletions
|
|
|
|
set relativenumber
|
|
|
|
|
|
|
|
" keeps an undofile next to files so that you can even undo if vim is closed
|
|
|
|
" in between
|
|
|
|
set undofile
|
|
|
|
|
|
|
|
" ignores case by default but will use case when search is specifically not
|
|
|
|
" all lowercased
|
|
|
|
set ignorecase
|
|
|
|
set smartcase
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
" whenever vim loses focus, save
|
|
|
|
au FocusLost * :wa
|
|
|
|
|
2019-03-13 16:18:47 +00:00
|
|
|
" disables showing us the current mode in the command line since airline takes
|
|
|
|
" care of it
|
|
|
|
set noshowmode
|
|
|
|
|
2019-03-17 18:45:29 +00:00
|
|
|
" highlight everything that goes over 80 columns
|
|
|
|
highlight ColorColumn ctermbg=magenta
|
|
|
|
call matchadd('ColorColumn', '\%81v', 100)
|
|
|
|
|
2019-03-13 14:08:39 +00:00
|
|
|
" KEYBINDINGS
|
|
|
|
"
|
|
|
|
" set our leader key to space since with hjkl, space is largely useless
|
|
|
|
let mapleader = "\<Space>"
|
|
|
|
" set jk to escape, in case capslock is not mapped to escape on the system
|
|
|
|
inoremap jk <ESC>
|
|
|
|
|
|
|
|
" remove search highlights by pressing space+/ - the key for searching the
|
|
|
|
" first place
|
|
|
|
nnoremap <leader>/ :noh<cr>
|
2019-03-09 20:27:14 +00:00
|
|
|
|
|
|
|
" move around between matching brackets with tab
|
|
|
|
nnoremap <tab> %
|
|
|
|
nnoremap <tab> %
|
2019-03-13 14:08:39 +00:00
|
|
|
|
|
|
|
" select the whole buffer with <leader>-a
|
|
|
|
map <leader>a ggVG
|
|
|
|
|
|
|
|
" quickly edit vimrc and source it on saving, useful for testing
|
|
|
|
map <leader>V :vsp ~/.config/nvim/init.vim<cr>
|
|
|
|
au BufWritePost init.vim so ~/.config/nvim/init.vim
|
|
|
|
|
|
|
|
" get rid of the help message popping up when I miss esc and hit F1
|
|
|
|
nnoremap <F1> <ESC>
|
|
|
|
inoremap <F1> <ESC>
|
|
|
|
vnoremap <F1> <ESC>
|
|
|
|
|
|
|
|
" remove all trailing whitespaces
|
|
|
|
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
|
|
|
|
|
|
|
|
" 'open new tab' with leader-t (opens new buffer and switches to it)
|
2019-03-15 15:26:57 +00:00
|
|
|
" open actual new tab with leader-T
|
2019-03-17 18:45:29 +00:00
|
|
|
nnoremap <leader>t :vsp .<cr>
|
2019-03-15 15:26:57 +00:00
|
|
|
nnoremap <leader>T :tabedit .<cr>
|
|
|
|
|
|
|
|
" save current buffer with Ctrl-s
|
|
|
|
nnoremap <C-s> :w<cr>
|
2019-03-13 17:01:53 +00:00
|
|
|
|
|
|
|
" open NERDtree with leader-e
|
|
|
|
nnoremap <leader>e :NERDTreeToggle<CR>
|