2014-04-09 08:07:12 -04:00
|
|
|
"============================================================"
|
|
|
|
" "
|
|
|
|
" Darkcloud Vim Config: main settings "
|
|
|
|
" "
|
2014-06-17 01:49:46 -04:00
|
|
|
" By: Kevin MacMartin (prurigro@gmail.com) "
|
2014-04-09 08:07:12 -04:00
|
|
|
" Website: https://github.com/prurigro/darkcloud-vimconfig "
|
|
|
|
" "
|
|
|
|
" License: MIT "
|
|
|
|
" "
|
|
|
|
"============================================================"
|
2014-02-20 23:24:20 -05:00
|
|
|
|
2014-07-21 02:36:50 -04:00
|
|
|
"GVIM SETTINGS: {{{
|
|
|
|
set guicursor+=a:blinkon0 "disable the blinking cursor
|
2014-07-21 03:29:27 -04:00
|
|
|
set guioptions=e "use the gui to render the list of open tabs
|
|
|
|
set guioptions+=g "make inactive menu items grey
|
|
|
|
set guioptions+=i "have the gui use the vim icon
|
|
|
|
set guioptions+=p "enable pointer callbacks for X11 (required by some WMs)
|
|
|
|
set guioptions+=h "prevent the cursor jumping to the longest line while scrolling
|
2014-08-06 00:19:46 -04:00
|
|
|
set winaltkeys=no "don't select the menu when pressing the alt-keys
|
2014-07-21 02:36:50 -04:00
|
|
|
"}}}
|
|
|
|
|
|
|
|
"COMPATIBILITY SETTINGS: {{{
|
|
|
|
set nocompatible "disable vi-compatibility settings
|
|
|
|
set backspace=indent,eol,start "enables/configures standard backspace behaviour
|
2014-02-20 23:24:20 -05:00
|
|
|
|
2014-07-21 02:36:50 -04:00
|
|
|
"use the '*' register as well as the the '+' register if it's available too
|
|
|
|
set clipboard=unnamed
|
2018-03-11 23:36:47 -04:00
|
|
|
|
|
|
|
if has('unnamedplus')
|
|
|
|
set clipboard+=unnamedplus
|
|
|
|
endif
|
2014-07-21 02:36:50 -04:00
|
|
|
|
|
|
|
"fancy mouse reporting with xterm2 fallback
|
2015-06-24 10:25:31 -04:00
|
|
|
if !has('nvim')
|
2018-03-11 23:36:47 -04:00
|
|
|
if has("mouse_sgr")
|
|
|
|
set ttymouse=sgr
|
|
|
|
else
|
|
|
|
set ttymouse=xterm2
|
|
|
|
endif
|
2015-06-24 10:25:31 -04:00
|
|
|
endif
|
2018-03-11 23:36:47 -04:00
|
|
|
|
2014-04-09 15:05:42 -04:00
|
|
|
set mouse=a "enables mouse functionality with extended capabilities
|
|
|
|
|
2014-07-21 02:36:50 -04:00
|
|
|
"8 colours in $TERM=linux, 256 elsewhere
|
2014-07-21 20:09:41 -04:00
|
|
|
if $TERM =~ '^linux$'|set t_Co=8|elseif !has("gui_running")|set t_Co=256|endif
|
2014-07-21 02:36:50 -04:00
|
|
|
set ttyfast "assume a fast connection to the terminal for better rendering
|
|
|
|
|
|
|
|
"configure to primarily use utf8
|
|
|
|
if has("multi_byte")
|
2018-03-11 23:36:47 -04:00
|
|
|
if &termencoding == ""
|
|
|
|
let &termencoding = &encoding
|
|
|
|
endif
|
|
|
|
|
2014-07-21 02:36:50 -04:00
|
|
|
set encoding=utf-8
|
|
|
|
setglobal fileencoding=utf-8
|
2014-03-11 03:05:09 -04:00
|
|
|
endif
|
2018-03-11 23:36:47 -04:00
|
|
|
|
2014-07-21 02:36:50 -04:00
|
|
|
set fileformats=unix,dos,mac "set compatible line endings in order of preference
|
2014-03-11 03:05:09 -04:00
|
|
|
"}}}
|
2014-02-20 23:24:20 -05:00
|
|
|
|
2014-07-21 02:36:50 -04:00
|
|
|
"GENERAL SETTINGS: {{{
|
2016-11-28 14:12:12 -05:00
|
|
|
"FILE: {{{
|
2014-07-21 02:36:50 -04:00
|
|
|
filetype plugin indent on "enable filetype-based auto-indentation
|
|
|
|
syntax on "enable syntax highlighting
|
|
|
|
set formatoptions=roqnl12 "how automatic formatting is to be done
|
|
|
|
set diffopt=foldcolumn:0,filler "vimdiff default settings
|
2018-04-09 16:11:10 -04:00
|
|
|
set foldmethod=syntax foldcolumn=1 foldlevel=2 "fold layers 3 and deeper
|
|
|
|
set nofoldenable "disable folds by default
|
2014-10-21 11:16:46 -04:00
|
|
|
set tw=80 "set the default text width to 80 when nothing overrides this
|
2019-03-15 11:58:18 -04:00
|
|
|
set maxmempattern=10000 "increase the maximum amount of memory available for pattern matching
|
2014-07-21 02:36:50 -04:00
|
|
|
"}}}
|
2014-02-21 02:34:23 -05:00
|
|
|
|
2014-07-21 02:36:50 -04:00
|
|
|
"USER INTERFACE: {{{
|
|
|
|
set laststatus=2 showcmd statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v] "statusline init and config
|
2015-05-04 12:47:00 -04:00
|
|
|
set winheight=1 winminheight=1 "set the minimum window height to 1 lines
|
|
|
|
set winwidth=1 winminwidth=1 "set the minimum window width to 1 columns
|
2014-12-01 00:31:28 -05:00
|
|
|
set noshowmode "don't display mode information handled by lightline
|
2014-07-30 07:17:31 -04:00
|
|
|
set lazyredraw "don't redraw the screen while macros are executing
|
2014-10-31 01:22:22 -04:00
|
|
|
set noequalalways "don't force splits to be equal in size when closing or opening one
|
2014-07-21 02:36:50 -04:00
|
|
|
set number "enable line numbers
|
|
|
|
set nowrap "disable line wrapping
|
|
|
|
set cursorline cursorcolumn "enable row/column highlighting
|
|
|
|
set visualbell "notify visually instead of with an audible bell
|
|
|
|
set splitright "add new tiles on the right (and not left) when added
|
2020-06-17 00:30:13 -04:00
|
|
|
set scrolloff=5 "scroll vertically when the cursor is 5 characters away from the top or bottom
|
|
|
|
set sidescroll=1 sidescrolloff=5 "scroll horizontally when the cursor is 5 chars away from the edge
|
2017-02-10 16:47:47 -05:00
|
|
|
set list listchars=tab:>-,trail:- "display tabs as: >--- and trailing spaces as: -
|
2014-07-21 02:36:50 -04:00
|
|
|
set showmatch "show matching open bracket when closed bracket is inserted
|
|
|
|
set matchtime=5 "the amount of time before the matching bracket will highlight
|
2018-03-11 23:36:47 -04:00
|
|
|
let &showbreak = "" "character to prepend to wrapped lines when linewrapping is enabled
|
2014-02-20 23:24:20 -05:00
|
|
|
|
2014-07-21 02:36:50 -04:00
|
|
|
"enable tab completion in command mode and configure how it handles extensions
|
|
|
|
set completeopt=longest,menuone
|
|
|
|
set wildmenu
|
|
|
|
set wildmode=list:longest,full
|
|
|
|
set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*.pyc,*.jpg,*.gif,*.png
|
|
|
|
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
|
|
|
|
"}}}
|
2014-04-02 11:17:12 -04:00
|
|
|
|
2014-07-21 02:36:50 -04:00
|
|
|
"BEHAVIOUR: {{{
|
|
|
|
set history=250 "size of the undo history
|
|
|
|
set whichwrap=b,s,<,>,[,] "scrolling left/right off current line wraps to the next/previous
|
2014-11-21 22:06:28 -05:00
|
|
|
set smarttab expandtab autoindent tabstop=4 shiftwidth=4 "configure tabs
|
2014-07-21 02:36:50 -04:00
|
|
|
set hlsearch incsearch ignorecase smartcase "configure how search behaves
|
2014-09-01 06:11:01 -04:00
|
|
|
set timeout timeoutlen=500 "how long before timing out for mappings
|
2014-07-24 00:51:58 -04:00
|
|
|
set ttimeout ttimeoutlen=100 "how long before timing out for terminal key codes
|
2019-06-05 00:36:27 -04:00
|
|
|
set nomodeline "disable the use of file-based modelines as these are insecure
|
2014-03-28 07:36:19 -04:00
|
|
|
|
2014-11-12 05:03:49 -05:00
|
|
|
"create ~/.vim/swap if necessary, then use as default swap file location
|
2018-03-11 23:36:47 -04:00
|
|
|
if exists('*mkdir') && !isdirectory($HOME.'/.vim/swap')
|
|
|
|
call mkdir($HOME.'/.vim/swap','p')
|
|
|
|
endif
|
|
|
|
|
2014-11-12 05:03:49 -05:00
|
|
|
set directory=$HOME/.vim/swap,.,/var/tmp,/tmp
|
|
|
|
|
2014-11-02 18:19:37 -05:00
|
|
|
"FUNCTIONS: {{{
|
2018-03-13 16:49:25 -04:00
|
|
|
"enable the auto-creation of missing folders in a save path
|
|
|
|
if !exists('*s:MakeNewDir')
|
|
|
|
function s:MakeNewDir(fullpath, buf)
|
|
|
|
if empty(getbufvar(a:buf,'&buftype')) && a:fullpath!~#'\v^\w+\:\/'
|
|
|
|
let dirpath = fnamemodify(a:fullpath,':h')
|
|
|
|
|
|
|
|
if !isdirectory(dirpath)
|
|
|
|
call mkdir(dirpath,'p')
|
2014-11-02 18:19:37 -05:00
|
|
|
endif
|
2018-03-13 16:49:25 -04:00
|
|
|
endif
|
|
|
|
endfunction
|
2018-03-11 23:36:47 -04:00
|
|
|
|
2018-03-13 16:49:25 -04:00
|
|
|
augroup WriteDir
|
2014-10-28 14:28:04 -04:00
|
|
|
autocmd!
|
2018-03-13 16:49:25 -04:00
|
|
|
autocmd BufWritePre * :call s:MakeNewDir(expand('<afile>'),+expand('<abuf>'))
|
2014-10-28 14:28:04 -04:00
|
|
|
augroup END
|
|
|
|
endif
|
|
|
|
|
2018-03-13 16:49:25 -04:00
|
|
|
"update the current filetype when a file is renamed
|
|
|
|
augroup RenameCheckFiletype
|
|
|
|
autocmd!
|
|
|
|
autocmd BufFilePost * filetype detect
|
|
|
|
augroup END
|
|
|
|
|
2014-11-02 18:19:37 -05:00
|
|
|
"functions to create a split using 33% and 66% of the height
|
|
|
|
function s:SPResize33()
|
|
|
|
sp|wincmd =|q
|
|
|
|
endfunction
|
2018-03-11 23:36:47 -04:00
|
|
|
|
2014-11-02 18:19:37 -05:00
|
|
|
function s:sp33()
|
|
|
|
sp|call s:SPResize33()|wincmd j
|
|
|
|
endfunction
|
2018-03-11 23:36:47 -04:00
|
|
|
|
2014-11-02 18:19:37 -05:00
|
|
|
command! -buffer SP33 call s:sp33()
|
2018-03-11 23:36:47 -04:00
|
|
|
|
2014-11-02 18:19:37 -05:00
|
|
|
function s:sp66()
|
|
|
|
sp|wincmd j|call s:SPResize33()
|
|
|
|
endfunction
|
2018-03-11 23:36:47 -04:00
|
|
|
|
2014-11-02 18:19:37 -05:00
|
|
|
command! -buffer SP66 call s:sp66()
|
2014-10-31 01:22:22 -04:00
|
|
|
|
2014-11-02 18:19:37 -05:00
|
|
|
"functions to create a vertical split using 33% and 66% width
|
|
|
|
function s:VSResize66()
|
|
|
|
vs|wincmd =|q
|
|
|
|
endfunction
|
2018-03-11 23:36:47 -04:00
|
|
|
|
2014-11-02 18:19:37 -05:00
|
|
|
function s:vs66()
|
|
|
|
vs|call s:VSResize66()
|
|
|
|
endfunction
|
2018-03-11 23:36:47 -04:00
|
|
|
|
2014-11-02 18:19:37 -05:00
|
|
|
command! -buffer VS66 call s:vs66()
|
2018-03-11 23:36:47 -04:00
|
|
|
|
2014-11-02 18:19:37 -05:00
|
|
|
function s:vs33()
|
|
|
|
vs|wincmd h|call s:VSResize66()|wincmd l
|
|
|
|
endfunction
|
2018-03-11 23:36:47 -04:00
|
|
|
|
2014-11-02 18:19:37 -05:00
|
|
|
command! -buffer VS33 call s:vs33()
|
|
|
|
"}}}
|
2014-07-21 02:36:50 -04:00
|
|
|
"}}}
|
2014-03-11 03:05:09 -04:00
|
|
|
"}}}
|