+ Improved VIMRC, unified vim_config name

This commit is contained in:
ziro 2020-07-13 09:02:15 +07:00
parent 09e9abab2c
commit 9d65e64c3b
5 changed files with 17 additions and 8 deletions

50
.config/vim/vim_nix Normal file
View file

@ -0,0 +1,50 @@
" vim: filetype=vim
" ==============================
" Linux Specific Configuration
" ==============================
" ----- Cleaning up
set undodir=$XDG_DATA_HOME/vim/undo
set directory=$XDG_DATA_HOME/vim/swap
set backupdir=$XDG_DATA_HOME/vim/backup
set viewdir=$XDG_DATA_HOME/vim/view
if !has('nvim')
set viminfo+='1000,n$XDG_DATA_HOME/vim/viminfo
else
set viminfo+='1000,n$XDG_DATA_HOME/nvim/nviminfo
endif
set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,$XDG_CONFIG_HOME/vim/after
let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
" ----- Mutt
au BufRead /tmp/mutt-* set tw=72
" ----- Execute Python
if !has("nvim")
autocmd FileType python map <buffer> <F9> :w<CR>:!clear; python3 "%"<CR>
autocmd FileType python imap <buffer> <F9> <esc>:w<CR>:!clear; python3 "%"<CR>
else
autocmd FileType python map <buffer> <F9> :w<CR>:vs<CR>:ter python3 "%"<CR>
autocmd FileType python imap <buffer> <F9> <esc> :w<CR>:vs<CR>:ter python3 "%"<CR>
endif
" ----- Automatically Render PDF
autocmd FileType plaintex command! -nargs=0 Lw w !pdflatex % > /dev/null
autocmd FileType tex command! -nargs=0 Lw w !pdflatex % > /dev/null
" ----- Auto refresh vimrc
augroup myvimrc
au!
au BufWritePost vimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
au BufWritePost vim_nix so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
au BufWritePost vim_plug so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
au BufWritePost vim_uni so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
au BufWritePost vim_win so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
augroup END
" ----- Install plug (Plugin Manager)
if empty(glob('~/.config/vim/autoload/plug.vim'))
silent !curl -fLo ~/.config/vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif