2023-01-20 03:00:34 +00:00
|
|
|
""" Plug-in management
|
|
|
|
" Install vim-plug if not found
|
|
|
|
if empty(glob('~/.vim/autoload/plug.vim'))
|
|
|
|
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
|
|
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
|
|
endif
|
|
|
|
|
|
|
|
" Run PlugInstall if there are missing plugins
|
|
|
|
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
|
|
|
\| PlugInstall --sync | source $MYVIMRC
|
|
|
|
\| endif
|
|
|
|
|
|
|
|
" Load Plug-ins
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'fatih/vim-go'
|
2023-01-22 19:51:42 +00:00
|
|
|
Plug 'bronson/vim-trailing-whitespace'
|
2023-02-20 18:11:33 +00:00
|
|
|
Plug 'preservim/nerdcommenter'
|
2023-01-20 03:00:34 +00:00
|
|
|
call plug#end()
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2022-05-24 15:59:24 +00:00
|
|
|
" Tmux integration to switch panes with Ctrl+{hjkl}
|
|
|
|
if exists('$TMUX')
|
|
|
|
function! TmuxOrSplitSwitch(wincmd, tmuxdir)
|
|
|
|
let previous_winnr = winnr()
|
|
|
|
silent! execute "wincmd " . a:wincmd
|
|
|
|
if previous_winnr == winnr()
|
|
|
|
call system("tmux select-pane -" . a:tmuxdir)
|
|
|
|
redraw!
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
let previous_title = substitute(system("tmux display-message -p '#{pane_title}'"), '\n', '', '')
|
|
|
|
let &t_ti = "\<Esc>2;vim\<Esc>\\" . &t_ti
|
|
|
|
let &t_te = "\<Esc>2;". previous_title . "\<Esc>\\" . &t_te
|
|
|
|
|
|
|
|
nnoremap <silent> <C-h> :call TmuxOrSplitSwitch('h', 'L')<cr>
|
|
|
|
nnoremap <silent> <C-j> :call TmuxOrSplitSwitch('j', 'D')<cr>
|
|
|
|
nnoremap <silent> <C-k> :call TmuxOrSplitSwitch('k', 'U')<cr>
|
|
|
|
nnoremap <silent> <C-l> :call TmuxOrSplitSwitch('l', 'R')<cr>
|
|
|
|
else
|
|
|
|
map <C-h> <C-w>h
|
|
|
|
map <C-j> <C-w>j
|
|
|
|
map <C-k> <C-w>k
|
|
|
|
map <C-l> <C-w>l
|
2022-08-16 21:18:54 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
" coding preferences
|
2023-01-20 03:00:34 +00:00
|
|
|
filetype off
|
|
|
|
filetype plugin indent on
|
|
|
|
|
2022-08-16 21:18:54 +00:00
|
|
|
syntax on
|
2023-01-20 03:00:34 +00:00
|
|
|
set backspace=indent,eol,start
|
|
|
|
set noautoindent
|
|
|
|
set noswapfile
|
|
|
|
set number
|
2022-08-16 21:18:54 +00:00
|
|
|
set ruler
|
2023-01-20 03:00:34 +00:00
|
|
|
set showmatch
|
|
|
|
set smarttab
|
|
|
|
set ts=2 sw=2 sts=2 expandtab
|
2023-02-20 18:11:33 +00:00
|
|
|
let g:NERDSpaceDelims=1
|
2023-01-20 03:00:34 +00:00
|
|
|
|
|
|
|
let mapleader=","
|
|
|
|
if has("autocmd")
|
|
|
|
autocmd FileType go set ts=2 sw=2 sts=2 noet nolist autowrite
|
|
|
|
endif
|