2021-01-07 08:09:41 +00:00
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
" - Prepare locations for main vim files -
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
if has('win32') || has ('win64')
|
|
|
|
let $VIMHOME = $HOME."/vimfiles"
|
|
|
|
else
|
|
|
|
let $VIMHOME = $HOME."/.vim"
|
|
|
|
let $NVIMHOME = $HOME."/.local/share/nvim"
|
|
|
|
endif
|
|
|
|
let $VIMPLUGINS = expand($VIMHOME."/plugins.vim")
|
|
|
|
let $LOCAL_VIMRC = $HOME."/.vimrc.local"
|
|
|
|
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
" - Load up plugins -
|
|
|
|
" -----------------------------------------------------------------------------
|
2021-01-19 10:05:24 +00:00
|
|
|
" Use local vimrc for overrides if available and desired
|
2021-01-19 10:10:28 +00:00
|
|
|
if filereadable($LOCAL_VIMRC)
|
2021-01-19 10:06:50 +00:00
|
|
|
source $LOCAL_VIMRC
|
|
|
|
endif
|
2021-01-07 08:09:41 +00:00
|
|
|
source $VIMPLUGINS
|
|
|
|
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
" - Indentation -
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
" show existing tab with 2 spaces width
|
|
|
|
set tabstop=2
|
|
|
|
" when indenting with '>', use 2 spaces width
|
|
|
|
set shiftwidth=2
|
|
|
|
" always set autoindenting on
|
|
|
|
set autoindent
|
|
|
|
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
" - Better commits -
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
syntax on
|
|
|
|
set spell spelllang=en_us
|
|
|
|
set encoding=utf-8
|
|
|
|
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
" - Style -
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
set number
|
|
|
|
set relativenumber
|
|
|
|
" This has been killing vim until it was resized
|
|
|
|
" set lines=50 columns=100
|
2021-02-25 15:11:33 +00:00
|
|
|
set termguicolors
|
|
|
|
colorscheme darcula
|
2021-01-07 08:09:41 +00:00
|
|
|
set background=dark
|
2021-01-18 06:59:37 +00:00
|
|
|
set guifont=SauceCodePro\ Nerd\ Font:h12
|
2021-01-07 08:09:41 +00:00
|
|
|
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
" - Miscellaneous -
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
" allow backspacing over everything in insert mode
|
|
|
|
set backspace=indent,eol,start
|
|
|
|
set ttimeoutlen=50
|
|
|
|
|
|
|
|
if has("vms")
|
|
|
|
set nobackup " do not keep a backup file, use versions instead
|
|
|
|
else
|
|
|
|
set backup " keep a backup file
|
|
|
|
endif
|
|
|
|
set history=50 " keep 50 lines of command line history
|
|
|
|
set ruler " show the cursor position all the time
|
|
|
|
set cursorline " highlight the current line
|
|
|
|
set laststatus=2 " Always display the status line
|
|
|
|
set noswapfile
|
|
|
|
set showcmd " display incomplete commands
|
|
|
|
set incsearch " do incremental searching
|
|
|
|
set autoread " Reload files changed outside vim
|
|
|
|
set hidden " Allow leaving unsaved buffers
|
|
|
|
|
|
|
|
" Trigger autoread when changing buffers or coming back to vim in terminal.
|
|
|
|
if !has('win32') && !has('win64')
|
|
|
|
autocmd FocusGained,BufEnter * :silent! !
|
|
|
|
endif
|
|
|
|
|
|
|
|
" In many terminal emulators the mouse works just fine, thus enable it.
|
|
|
|
if has('mouse')
|
|
|
|
set mouse=a
|
|
|
|
endif
|
|
|
|
|
|
|
|
" Switch syntax highlighting on, when the terminal has colors
|
|
|
|
" Also switch on highlighting the last used search pattern.
|
|
|
|
if &t_Co > 2 || has("gui_running")
|
|
|
|
syntax on
|
|
|
|
set hlsearch
|
|
|
|
endif
|
|
|
|
|
|
|
|
" Allow recursive searches
|
|
|
|
set path+=**
|
|
|
|
|
|
|
|
" Save whenever switching windows or leaving vim. This is useful when running
|
|
|
|
" the tests inside vim without having to save all files first.
|
|
|
|
autocmd FocusLost,WinLeave * :silent! wa
|
|
|
|
|
|
|
|
" automatically rebalance windows on vim resize
|
|
|
|
autocmd VimResized * :wincmd =
|
|
|
|
|
|
|
|
" automatically save open .org files
|
|
|
|
autocmd CursorHold *.org :write
|
|
|
|
|
|
|
|
" Set tags to default tags file generated by gentags script
|
|
|
|
set tags=./tags.gitignored;
|
|
|
|
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
" - Common mapping -
|
|
|
|
" -----------------------------------------------------------------------------
|
|
|
|
let mapleader = " "
|
|
|
|
let maplocalleader = " "
|
|
|
|
|
|
|
|
" Don't use Ex mode, use Q for formatting
|
|
|
|
map Q gq
|
|
|
|
|
|
|
|
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
|
|
|
|
" so that you can undo CTRL-U after inserting a line break.
|
|
|
|
inoremap <C-U> <C-G>u<C-U>
|
|
|
|
|
|
|
|
" Allow :W and :Wq to save too
|
|
|
|
command! Wq :wq
|
|
|
|
command! W :w
|
|
|
|
|
|
|
|
" Close extra windows
|
|
|
|
noremap <Leader>c :ccl <bar> lcl<CR>
|
|
|
|
|
|
|
|
if &term =~ '256color'
|
|
|
|
" disable Background Color Erase (BCE) so that color schemes
|
|
|
|
" render properly when inside 256-color tmux and GNU screen.
|
|
|
|
set t_ut=
|
|
|
|
endif
|