update init.vim
reorganize the file a bit
This commit is contained in:
parent
0fea4f25c7
commit
8b2e5aff49
216
init.vim
216
init.vim
@ -1,14 +1,10 @@
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" "
|
||||
" Maintainer: Patrick Auernig <patrick DOT auernig AT gmail DOT com> "
|
||||
" VIM Version: NVIM 0.1.3 "
|
||||
" "
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Maintainer: Patrick Auernig <patrick DOT auernig AT gmail DOT com>
|
||||
" VIM Version: NVIM 0.1.4
|
||||
" Source: https://gitlab.com/valeth/vim-config
|
||||
" Mirror: https://github.com/valeth/vim-config
|
||||
|
||||
|
||||
"""""""""""""""""""
|
||||
" XDG Directories "
|
||||
"""""""""""""""""""
|
||||
" XDG Directories {{{
|
||||
let g:vim_config_home = split(&rtp, ',', 0)[0]
|
||||
|
||||
if exists('$XDG_CACHE_HOME')
|
||||
@ -22,53 +18,102 @@ if exists('$XDG_DATA_HOME')
|
||||
else
|
||||
let g:vim_data_home = expand('$HOME/.local/share/') . v:progname
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" Settings {{{
|
||||
|
||||
""""""""""""
|
||||
" Settings "
|
||||
""""""""""""
|
||||
" prompt with save dialog on exit
|
||||
set confirm
|
||||
|
||||
" wait only a short amount of time
|
||||
set notimeout
|
||||
set ttimeout
|
||||
set timeoutlen=500
|
||||
set timeoutlen=10
|
||||
set visualbell t_vb=
|
||||
|
||||
" automatically do stuff
|
||||
set autochdir
|
||||
set autowrite
|
||||
set scrolloff=1
|
||||
set autoread
|
||||
set autowriteall
|
||||
|
||||
" scroll n lines before hitting the border
|
||||
set scrolloff=3
|
||||
set sidescrolloff=5
|
||||
|
||||
" show line numbers
|
||||
set number
|
||||
|
||||
" show position
|
||||
set ruler
|
||||
|
||||
" ignore case when searching
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set listchars=tab:»\ ,trail:◆,extends:▹,precedes:◃,eol:↲,nbsp:·
|
||||
set incsearch
|
||||
set gdefault
|
||||
|
||||
" show matching parenthesis
|
||||
set showmatch
|
||||
set shortmess=aoOtTI
|
||||
set clipboard+=unnamed
|
||||
set smartindent
|
||||
set undofile
|
||||
set splitbelow
|
||||
set splitright
|
||||
set matchtime=3
|
||||
|
||||
|
||||
" show hidden characters
|
||||
set listchars=tab:»\ ,trail:◆,extends:❯,precedes:❮,eol:↲,nbsp:·
|
||||
set breakindent
|
||||
set breakindentopt=sbr
|
||||
let &showbreak = '↳ '
|
||||
set ruler
|
||||
set showcmd
|
||||
set showbreak=↳
|
||||
set list
|
||||
|
||||
set shortmess=aoOtTI
|
||||
|
||||
" share yank buffer with system clipboard
|
||||
set clipboard+=unnamed
|
||||
|
||||
" indent automatically
|
||||
set autoindent
|
||||
set smartindent
|
||||
|
||||
set undofile
|
||||
|
||||
set noswapfile
|
||||
|
||||
" change split behaviour
|
||||
set splitbelow
|
||||
set splitright
|
||||
|
||||
" show sane line lenght limit marker
|
||||
set colorcolumn=+3
|
||||
|
||||
" wildmenu completion
|
||||
set wildmenu
|
||||
set wildmode=list:longest,full
|
||||
set wildignore=.bak,.old,.swp,~
|
||||
set virtualedit=block
|
||||
set wildignore+=.git
|
||||
set wildignore+=*.bak,*.old,*.swp,*~
|
||||
set wildignore+=*.o,*.hi
|
||||
set wildignore+=*.pyc,*.class
|
||||
set wildignore+=*.pdf,*.aux
|
||||
set wildignore+=*.png,*.jpg
|
||||
|
||||
set virtualedit+=block
|
||||
|
||||
set foldcolumn=1
|
||||
set foldlevel=99
|
||||
set foldmethod=syntax
|
||||
set foldtext=myfold#text()
|
||||
set visualbell
|
||||
set t_vb=
|
||||
|
||||
set complete=.,w,b,u,t
|
||||
set completeopt=longest,menuone,preview
|
||||
|
||||
" enable syntax highlighting and filetype detection
|
||||
filetype indent on
|
||||
filetype plugin on
|
||||
syntax enable
|
||||
set synmaxcol=300
|
||||
" }}}
|
||||
|
||||
|
||||
"""""""""""""""""""""
|
||||
" Keyboard mappings "
|
||||
"""""""""""""""""""""
|
||||
" Keyboard mappings {{{
|
||||
let g:mapleader = ","
|
||||
let g:maplocalleader = "\\"
|
||||
|
||||
command! Wq wq
|
||||
command! WQ wq
|
||||
@ -77,7 +122,6 @@ command! W w
|
||||
|
||||
noremap <silent> <Leader><CR> :noh<CR>
|
||||
|
||||
nnoremap <F1> <NOP>
|
||||
nnoremap U :redo<CR>
|
||||
nnoremap <C-R> <NOP>
|
||||
nnoremap <Leader>vl :setlocal cursorline!<CR>
|
||||
@ -97,61 +141,121 @@ nnoremap tk :tabprev<CR>
|
||||
nnoremap tl :tablast<CR>
|
||||
nnoremap tn :tabnew<CR>
|
||||
nnoremap tq :tabclose<CR>
|
||||
nnoremap <silent> <leader>il :set invlist<CR>
|
||||
|
||||
inoremap <F1> <NOP>
|
||||
nnoremap <CR> o<ESC>
|
||||
|
||||
" change beginning and end mappings
|
||||
noremap H ^
|
||||
noremap L $
|
||||
vnoremap L g_
|
||||
inoremap <C-a> <ESC>I
|
||||
inoremap <C-e> <ESC>A
|
||||
cnoremap <C-a> <HOME>
|
||||
cnoremap <C-e> <END>
|
||||
|
||||
" movement
|
||||
noremap j gj
|
||||
noremap k gk
|
||||
noremap gj j
|
||||
noremap gj j
|
||||
|
||||
" go to last change
|
||||
nnoremap gC `.
|
||||
|
||||
" stay in center when searching
|
||||
nnoremap n nzzzv
|
||||
nnoremap N Nzzzv
|
||||
|
||||
nnoremap g; g;zz
|
||||
nnoremap g, g,zz
|
||||
nnoremap <C-o> <C-o>zz
|
||||
|
||||
" toggle invlist
|
||||
nnoremap <silent> <leader>il :set invlist<CR>
|
||||
vnoremap <silent> <leader>il :<C-W>set invlist<CR>
|
||||
|
||||
" make substitutions more convenient
|
||||
nnoremap <C-s> :%s/
|
||||
vnoremap <C-s> :s/
|
||||
|
||||
nnoremap / /\v
|
||||
vnoremap / /\v
|
||||
|
||||
" quicker escape
|
||||
inoremap jk <ESC>
|
||||
inoremap JK <ESC>
|
||||
inoremap Jk <ESC>
|
||||
|
||||
" indent in visual mode and keep selection
|
||||
vnoremap < <gv
|
||||
vnoremap > >gv
|
||||
vnoremap <silent> <leader>il :<C-W>set invlist<CR>
|
||||
|
||||
cnoremap sudow w !sudo tee % >/dev/null
|
||||
" just in case I forgot sudo again
|
||||
cnoremap w! w !sudo tee % >/dev/null
|
||||
|
||||
tnoremap <ESC> <C-\><C-n>
|
||||
tnoremap <leader><ESC> <ESC>
|
||||
|
||||
" NOP(E)s
|
||||
noremap <F1> <NOP>
|
||||
noremap <Left> <NOP>
|
||||
noremap <Right> <NOP>
|
||||
noremap <Up> <NOP>
|
||||
noremap <Down> <NOP>
|
||||
" }}}
|
||||
|
||||
""""""""""""""""
|
||||
" Autocommands "
|
||||
""""""""""""""""
|
||||
aug ToggleLineNumbers
|
||||
" Autocommands {{{
|
||||
augroup LineReturn
|
||||
au!
|
||||
au BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ execute 'normal! g`"zvzz' |
|
||||
\ endif
|
||||
augroup END
|
||||
|
||||
augroup ToggleLineNumbers
|
||||
au!
|
||||
au VimEnter,WinEnter,InsertLeave * setlocal relativenumber
|
||||
au WinLeave,InsertEnter * setlocal norelativenumber
|
||||
aug END
|
||||
augroup END
|
||||
|
||||
aug CursorLineColumn
|
||||
augroup CursorLineColumn
|
||||
au!
|
||||
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline cursorcolumn
|
||||
au WinLeave * setlocal nocursorline nocursorcolumn
|
||||
aug END
|
||||
augroup END
|
||||
|
||||
augroup AutoReload
|
||||
au!
|
||||
au BufWritePost $MYVIMRC source $MYVIMRC
|
||||
augroup END
|
||||
|
||||
au FocusLost * :silent! wa
|
||||
|
||||
"""""""""""
|
||||
" Plugins "
|
||||
"""""""""""
|
||||
" keep splits equal on terminal resize
|
||||
au VimResized * :wincmd =
|
||||
|
||||
augroup Trailing
|
||||
au!
|
||||
au InsertEnter * :set invlist
|
||||
au InsertLeave * :set invlist
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
" Plugins {{{
|
||||
call plug#begin(g:vim_data_home . '/plugins')
|
||||
runtime! plugins/**/*.vim
|
||||
call plug#end()
|
||||
" }}}
|
||||
|
||||
|
||||
"""""""""""""""
|
||||
" Colorscheme "
|
||||
"""""""""""""""
|
||||
" Colorscheme {{{
|
||||
function! ToggleColorscheme()
|
||||
if g:colors_name == 'PaperColor'
|
||||
call ToggleBackground()
|
||||
elseif g:colors_name =~ 'seoul256'
|
||||
if g:colors_name =~ 'seoul256'
|
||||
call ToggleSeoul256()
|
||||
elseif g:colors_name =~ 'Tomorrow'
|
||||
call ToggleTomorrow()
|
||||
else
|
||||
call ToggleBackground()
|
||||
endif
|
||||
|
||||
AirlineRefresh
|
||||
@ -169,4 +273,6 @@ endfunction
|
||||
colorscheme seoul256
|
||||
"colorscheme PaperColor
|
||||
"colorscheme Tomorrow-Night
|
||||
" }}}
|
||||
|
||||
" vim:set foldmethod=marker foldlevel=0:
|
||||
|
Loading…
Reference in New Issue
Block a user