158 lines
3.7 KiB
VimL
158 lines
3.7 KiB
VimL
""
|
|
"" Environment
|
|
""
|
|
|
|
" Vim environment
|
|
let data = $XDG_DATA_HOME.'/nvim'
|
|
let config = $XDG_CONFIG_HOME.'/nvim'
|
|
let cache = $XDG_CACHE_HOME .'/nvim'
|
|
let plugins = data.'/plugins'
|
|
|
|
let &directory = cache.',~/,/tmp'
|
|
let &backupdir = cache.',~/,/tmp'
|
|
let &viminfo = cache.'/info'
|
|
|
|
" Netrw data
|
|
let g:netrw_home = cache.'/netrw'
|
|
|
|
" Keep history
|
|
let &undodir = cache.'/undo'
|
|
set undofile
|
|
|
|
|
|
""
|
|
"" Plugins
|
|
""
|
|
|
|
call plug#begin(plugins)
|
|
|
|
" UI
|
|
Plug 'kien/ctrlp.vim'
|
|
Plug 'itchyny/lightline.vim'
|
|
Plug 'airblade/vim-gitgutter'
|
|
Plug 'mbbill/undotree', { 'on' : 'UndotreeToggle' }
|
|
Plug 'milkypostman/vim-togglelist'
|
|
|
|
" Syntax
|
|
Plug 'travitch/hasksyn'
|
|
Plug 'LnL7/vim-nix'
|
|
Plug 'vim-pandoc/vim-pandoc-syntax'
|
|
Plug 'hdima/python-syntax'
|
|
Plug 'dag/vim-fish'
|
|
|
|
" Misc
|
|
Plug 'townk/vim-autoclose'
|
|
Plug 'tpope/vim-fugitive'
|
|
Plug 'ervandew/supertab'
|
|
Plug 'neomake/neomake'
|
|
|
|
call plug#end()
|
|
|
|
|
|
""
|
|
"" Options
|
|
""
|
|
|
|
set hidden " Hide buffers
|
|
set mouse=a " Enable mouse support
|
|
set ignorecase " Case insensitive search...
|
|
set smartcase " ...for lowercase terms
|
|
set nowrap " Disable line wrap
|
|
set nofoldenable " Disable folding
|
|
|
|
set fsync " Sync writes
|
|
set noswapfile " Disable swap files
|
|
set writebackup " Backup file before overwriting...
|
|
set nobackup " ...but delete it on success
|
|
|
|
set nomodeline " Disable for Security
|
|
set showmatch " Highlight matched parenthesis
|
|
set clipboard=unnamedplus " Yank to clipboard
|
|
set wildignore+=*/tmp/*,*.so,*.swp " Files to ignore
|
|
|
|
set shiftwidth=2 " Tabs
|
|
set tabstop=2 "
|
|
set expandtab "
|
|
|
|
set number " Line numbering
|
|
set smartindent " Indentation
|
|
set noshowmode " Disable printing of mode changes
|
|
set noruler " Already in statusline
|
|
set fillchars=eob:\ " Hide ~ on empty lines
|
|
|
|
runtime colors.vim " Load color scheme
|
|
filetype indent plugin on " Identify file type
|
|
|
|
|
|
""
|
|
"" Terminal mode
|
|
""
|
|
|
|
" Hide some elements
|
|
autocmd TermOpen * setlocal nonumber
|
|
autocmd TermEnter * set laststatus=0
|
|
autocmd TermLeave * set laststatus=2
|
|
|
|
" Exit without confirmation
|
|
autocmd TermClose * call feedkeys("\<CR>")
|
|
|
|
" Easier escape
|
|
tnoremap <C-b> <C-\><C-n>
|
|
|
|
" Emulate tmux
|
|
map <silent><C-w>- :split +term<CR>
|
|
map <silent><C-w>\| :vsplit +term<CR>
|
|
map <silent><C-w>t :tabnew +term<CR>
|
|
map <silent><C-w>c :quit<CR>
|
|
|
|
|
|
""
|
|
"" Key bindings
|
|
""
|
|
let mapleader=","
|
|
|
|
" Plugins
|
|
map <Leader>u :UndotreeToggle<CR>
|
|
|
|
" Misc
|
|
inoremap kj <ESC>
|
|
noremap o o<ESC>
|
|
noremap O O<ESC>
|
|
|
|
" keep selection after p
|
|
xnoremap <silent> p p:let @+=@0<CR>
|
|
|
|
" save with sudo
|
|
cmap w!! w !sudo tee > /dev/null %
|
|
|
|
|
|
""
|
|
"" Plugin options
|
|
""
|
|
|
|
" Lightline
|
|
runtime lightline.vim
|
|
|
|
" Neomake
|
|
call neomake#configure#automake('nwr', 750)
|
|
let g:neomake_warning_sign = {
|
|
\ 'text': 'W→',
|
|
\ 'texthl': 'WarningMsg',
|
|
\ }
|
|
let g:neomake_error_sign = {
|
|
\ 'text': 'E→',
|
|
\ 'texthl': 'ErrorMsg',
|
|
\ }
|
|
let g:neomake_highlight_lines = 1
|
|
let g:neomake_virtualtext_current_error = 0
|
|
|
|
" CtrlP
|
|
let g:ctrlp_clear_cache_on_exit = 0
|
|
let g:ctrlp_follow_symlinks = 1
|
|
let g:ctrlp_custom_ignore = {"dir": "\v[\/]\.git$"}
|
|
let g:ctrlp_status_func = {"main": "CtrlPStatusMain",
|
|
\"prog": "CtrlPStatusProg"}
|
|
|
|
" Pandoc Markdown
|
|
autocmd! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
|