dotvim/init.vim

158 lines
3.7 KiB
VimL
Raw Permalink Normal View History

2015-10-10 15:34:29 +02:00
""
"" Environment
""
2015-10-10 19:38:14 +02:00
" Vim environment
2018-11-10 17:20:21 +01:00
let data = $XDG_DATA_HOME.'/nvim'
2016-04-13 21:39:52 +02:00
let config = $XDG_CONFIG_HOME.'/nvim'
2018-11-10 17:20:21 +01:00
let cache = $XDG_CACHE_HOME .'/nvim'
let plugins = data.'/plugins'
2016-04-13 21:39:52 +02:00
let &directory = cache.',~/,/tmp'
let &backupdir = cache.',~/,/tmp'
let &viminfo = cache.'/info'
2015-10-10 15:34:29 +02:00
2019-05-10 22:43:14 +02:00
" Netrw data
let g:netrw_home = cache.'/netrw'
2015-10-10 19:38:14 +02:00
" Keep history
2016-04-13 21:39:52 +02:00
let &undodir = cache.'/undo'
2015-10-10 17:23:21 +02:00
set undofile
2013-11-22 18:20:32 +01:00
2015-10-11 14:52:54 +02:00
""
"" Plugins
""
2018-11-10 17:20:21 +01:00
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'
2019-04-30 02:18:58 +02:00
Plug 'dag/vim-fish'
2018-11-10 17:20:21 +01:00
" Misc
Plug 'townk/vim-autoclose'
Plug 'tpope/vim-fugitive'
Plug 'ervandew/supertab'
Plug 'neomake/neomake'
call plug#end()
2015-10-11 14:52:54 +02:00
2013-11-22 18:20:32 +01:00
""
2015-10-10 17:36:28 +02:00
"" Options
2013-11-22 18:20:32 +01:00
""
2015-10-10 17:36:28 +02:00
set hidden " Hide buffers
2017-05-04 21:13:45 +02:00
set mouse=a " Enable mouse support
2015-10-10 17:36:28 +02:00
set ignorecase " Case insensitive search...
set smartcase " ...for lowercase terms
2016-01-17 16:04:28 +01:00
set nowrap " Disable line wrap
2015-10-11 15:05:33 +02:00
set nofoldenable " Disable folding
2015-10-10 17:36:28 +02:00
set fsync " Sync writes
2015-10-10 17:36:28 +02:00
set noswapfile " Disable swap files
set writebackup " Backup file before overwriting...
set nobackup " ...but delete it on success
2015-10-10 17:36:28 +02:00
set nomodeline " Disable for Security
2015-10-10 17:36:28 +02:00
set showmatch " Highlight matched parenthesis
set clipboard=unnamedplus " Yank to clipboard
2015-10-10 17:36:28 +02:00
set wildignore+=*/tmp/*,*.so,*.swp " Files to ignore
set shiftwidth=2 " Tabs
2015-10-12 00:09:54 +02:00
set tabstop=2 "
set expandtab "
2015-10-10 17:36:28 +02:00
set number " Line numbering
2016-04-13 21:39:52 +02:00
set smartindent " Indentation
set noshowmode " Disable printing of mode changes
2021-03-16 12:00:15 +01:00
set noruler " Already in statusline
set fillchars=eob:\ " Hide ~ on empty lines
2015-10-10 17:36:28 +02:00
2016-04-13 21:39:52 +02:00
runtime colors.vim " Load color scheme
filetype indent plugin on " Identify file type
2015-10-10 17:36:28 +02:00
2018-07-29 17:34:33 +02:00
2021-03-16 12:00:15 +01:00
""
"" 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>
2013-11-22 18:20:32 +01:00
""
2015-10-10 17:36:28 +02:00
"" Key bindings
2013-11-22 18:20:32 +01:00
""
2015-10-11 14:52:54 +02:00
let mapleader=","
2013-11-22 18:20:32 +01:00
2018-10-28 18:23:18 +01:00
" Plugins
map <Leader>u :UndotreeToggle<CR>
" Misc
2019-11-07 19:04:13 +01:00
inoremap kj <ESC>
2018-10-28 19:05:44 +01:00
noremap o o<ESC>
noremap O O<ESC>
2013-11-22 18:20:32 +01:00
2019-09-05 18:16:33 +02:00
" keep selection after p
xnoremap <silent> p p:let @+=@0<CR>
2019-06-20 16:31:03 +02:00
" save with sudo
cmap w!! w !sudo tee > /dev/null %
2013-11-22 18:20:32 +01:00
""
2015-10-10 17:23:21 +02:00
"" Plugin options
2013-11-22 18:20:32 +01:00
""
2015-10-10 17:23:21 +02:00
" Lightline
2016-04-13 21:39:52 +02:00
runtime lightline.vim
2013-11-22 18:20:32 +01:00
2018-11-10 17:20:21 +01:00
" 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
2019-05-08 00:07:49 +02:00
let g:neomake_virtualtext_current_error = 0
2013-11-22 18:20:32 +01:00
2015-10-10 17:23:21 +02:00
" CtrlP
2015-10-10 19:38:14 +02:00
let g:ctrlp_clear_cache_on_exit = 0
2018-04-24 19:13:56 +02:00
let g:ctrlp_follow_symlinks = 1
let g:ctrlp_custom_ignore = {"dir": "\v[\/]\.git$"}
2015-10-10 19:38:14 +02:00
let g:ctrlp_status_func = {"main": "CtrlPStatusMain",
\"prog": "CtrlPStatusProg"}
2018-07-29 17:43:26 +02:00
" Pandoc Markdown
autocmd! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc