125 lines
3.4 KiB
VimL
125 lines
3.4 KiB
VimL
" defines plugin directory
|
|
" Install plugins from vim with :PlugInstall
|
|
call plug#begin('~/.local/share/nvim/plugged')
|
|
|
|
" Base
|
|
Plug 'tpope/vim-sensible'
|
|
Plug 'tpope/vim-commentary'
|
|
Plug 'christoomey/vim-tmux-navigator' " add seamless movement between vim and tmux
|
|
|
|
" Ecosystem
|
|
" Plug 'tpope/vim-fugitive' - Will have to take a closer look some other time
|
|
Plug 'scrooloose/nerdtree'
|
|
|
|
" Language Integration
|
|
Plug 'stephpy/vim-yaml'
|
|
|
|
" Design
|
|
Plug 'vim-airline/vim-airline'
|
|
Plug 'vim-airline/vim-airline-themes'
|
|
Plug 'edkolev/tmuxline.vim'
|
|
|
|
" Colorschemes
|
|
Plug 'Nequo/vim-allomancer'
|
|
|
|
call plug#end()
|
|
|
|
" PLUGIN CONFIGURATION
|
|
let g:airline_powerline_fonts=1
|
|
let g:airline_theme='raven'
|
|
colorscheme allomancer
|
|
|
|
" 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
|
|
" 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' : {}}
|
|
|
|
" automatically save the current buffer when navigating away from vim
|
|
let g:tmux_navigator_save_on_switch = 1
|
|
|
|
" VIM SETTINGS
|
|
" set truecolor (neovim)
|
|
set termguicolors
|
|
|
|
" many of these come from
|
|
" http://stevelosh.com/blog/2010/09/coming-home-to-vim/
|
|
|
|
" 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/
|
|
set tabstop=4
|
|
set shiftwidth=4
|
|
set softtabstop=4
|
|
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
|
|
|
|
" whenever vim loses focus, save
|
|
au FocusLost * :wa
|
|
|
|
" disables showing us the current mode in the command line since airline takes
|
|
" care of it
|
|
set noshowmode
|
|
|
|
" 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>
|
|
|
|
" move around between matching brackets with tab
|
|
nnoremap <tab> %
|
|
nnoremap <tab> %
|
|
|
|
" 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)
|
|
" open actual new tab with leader-T
|
|
nnoremap <leader>t <C-w>v<C-w><C-w>:NERDTreeToggle<cr>
|
|
nnoremap <leader>T :tabedit .<cr>
|
|
|
|
" save current buffer with Ctrl-s
|
|
nnoremap <C-s> :w<cr>
|
|
|
|
" open NERDtree with leader-e
|
|
nnoremap <leader>e :NERDTreeToggle<CR>
|