reorganized settings, improved comment descriptions of settings, improved clipboard settings, reduced timeout for keystroke combinations, tweaked and improved a few other small things, added a function to autocreate missing directories in save paths, have a few files required by various plugins auto-created at startup if they don't exist

This commit is contained in:
Kevin MacMartin 2014-07-21 02:36:50 -04:00
parent d5cde13a13
commit a1d28990fb
3 changed files with 94 additions and 68 deletions

View file

@ -28,6 +28,14 @@ if has("autocmd") && exists("+omnifunc")
endif endif
"FILETPE AND SYNTAX: {{{ "FILETPE AND SYNTAX: {{{
"set given filenames to various filetypes
au BufNewFile,BufRead pacman.conf,yaourtrc setf sh
au BufNewFile,BufRead cjdroute.conf,cjdmaid.conf setf json
au BufNewFile,BufRead *muttrc setf muttrc
au BufNewFile,BufRead *ircd.conf setf javascript
au BufNewFile,BufRead *.aspx,*.asmx,*.ascx,*.master setf aspnet
au BufNewFile,BufRead *.gradle setf groovy
"filename specific settings "filename specific settings
autocmd BufEnter,BufRead *taskrc setlocal commentstring=#\ %s autocmd BufEnter,BufRead *taskrc setlocal commentstring=#\ %s
autocmd BufEnter,BufRead PKGBUILD setlocal iskeyword-=. autocmd BufEnter,BufRead PKGBUILD setlocal iskeyword-=.

View file

@ -9,7 +9,13 @@
" " " "
"============================================================" "============================================================"
"PATHOGEN BUNDLED EXTENSIONS PLUGIN: {{{ "INITIALIZE PLUGINS: {{{
"create missing plugin user config files
if !filereadable(glob("~/.vim/tags"))|new|silent e ~/.vim/tags|silent w|q|endif
if !filereadable(glob("~/.vim/snippets.json"))|new|silent e ~/.vim/snippets.json|silent w|q|endif
if !filereadable(glob("~/.vim/filetypes.vim"))|new|silent e ~/.vim/filetypes.vim|silent w|q|endif
"load plugins in vim/bundle/ and vim/bundle.user/
execute pathogen#infect('bundle/{}', 'bundle.user/{}') execute pathogen#infect('bundle/{}', 'bundle.user/{}')
"}}} "}}}

View file

@ -9,50 +9,59 @@
" " " "
"============================================================" "============================================================"
"COMPATIBILITY SETTINGS: DOCUMENT AND ENVIRONMENT SETTINGS {{{ "GVIM SETTINGS: {{{
set nocompatible "enable vim specific capabilities set guicursor+=a:blinkon0 "disable the blinking cursor
set encoding=utf-8 "set encoding set guioptions=aegip "enable some good defaults for gvim
set fileformats=unix,dos,mac "set compatible line endings in order of preference set guioptions+=lRb "enable scrollbars (right only when a split is present)
set backspace=indent,eol,start "enables backspacing "}}}
set clipboard=unnamedplus "enable copy/paste support between vim and the environment's clipboard
"COMPATIBILITY SETTINGS: {{{
set nocompatible "disable vi-compatibility settings
set backspace=indent,eol,start "enables/configures standard backspace behaviour
"use the '*' register as well as the the '+' register if it's available too
set clipboard=unnamed
if has('unnamedplus')|set clipboard+=unnamedplus|endif
"fancy mouse reporting with xterm2 fallback
if has("mouse_sgr")|set ttymouse=sgr|else|set ttymouse=xterm2|endif
set mouse=a "enables mouse functionality with extended capabilities
"8 colours in $TERM=linux, 256 elsewhere
if $TERM =~ '^linux'|set t_Co=8|elseif !has("gui_running")|set t_Co=256|endif
set lazyredraw "only redraw what needs to be redrawn set lazyredraw "only redraw what needs to be redrawn
set ttyfast "assume a fast connection to the terminal for better rendering set ttyfast "assume a fast connection to the terminal for better rendering
set mouse=a "enables mouse functionality with extended capabilities "configure to primarily use utf8
if has("mouse_sgr") if has("multi_byte")
set ttymouse=sgr "use mouse handling that emits sgr-style reporting if it's available if &termencoding == ""|let &termencoding = &encoding|endif
else set encoding=utf-8
set ttymouse=xterm2 "fall back to xterm2-style reporting if sgr isn't available setglobal fileencoding=utf-8
endif
if $TERM =~ '^linux'
set t_Co=8 "use 8 colours when a vterm is detected
elseif !has("gui_running")
set t_Co=256 "assume 256 colours when any other terminal is detected
endif endif
set fileformats=unix,dos,mac "set compatible line endings in order of preference
"}}} "}}}
"GENERAL: ANYTHING THAT DOESN'T FIT ELSEWHERE {{{ "GENERAL SETTINGS: {{{
"FILETYPES: {{{
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
set foldmethod=syntax foldcolumn=1 foldlevel=5 "fold layers 5 or more deep
"}}}
"USER INTERFACE: {{{
set laststatus=2 showcmd statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v] "statusline init and config
set number "enable line numbers set number "enable line numbers
set nowrap "disable line wrapping set nowrap "disable line wrapping
set cursorline cursorcolumn "enable row/column highlighting set cursorline cursorcolumn "enable row/column highlighting
set visualbell "notify visually instead of with an audible bell set visualbell "notify visually instead of with an audible bell
set splitright "add new tiles on the right (and not left) when added set splitright "add new tiles on the right (and not left) when added
set scrolloff=0 sidescrolloff=0 "start scrolling if the cursor is one position away from the edge set scrolloff=0 sidescrolloff=0 "start scrolling if the cursor is one position away from the edge
set list listchars=tab:>-,trail:- "display tabs as: >--- and trailing spaces as: - set list listchars=tab:>-,trail:- "display tabs as: >-- and trailing spaces as: -
set autochdir "current dir is file dir
set history=250 "undo history
set timeoutlen=800 ttimeoutlen=0 "shorten the timeout length of escapes
set whichwrap=b,s,<,>,[,] "allow the cursor to wrap lines
set showmatch "show matching open bracket when closed bracket is inserted set showmatch "show matching open bracket when closed bracket is inserted
set matchtime=5 "the amount of time the matching bracket will highlight set matchtime=5 "the amount of time before the matching bracket will highlight
set smarttab expandtab autoindent tabstop=4 shiftwidth=4 "configure tabs let &showbreak="" "character to prepend to wrapped lines when linewrapping is enabled
set laststatus=2 showcmd statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v] "statusline init and config
set hlsearch incsearch ignorecase smartcase "configure search
set diffopt=foldcolumn:0,filler "vimdiff default settings
set formatoptions=roqnl12 "how automatic formatting is to be done
set foldmethod=syntax foldcolumn=1 foldlevel=5 "fold layers 5 or more deep
let &showbreak="" "highlight wrapped lines when linewrap is enabled
"enable tab completion in command mode and configure how it handles extensions "enable tab completion in command mode and configure how it handles extensions
set completeopt=longest,menuone set completeopt=longest,menuone
@ -62,21 +71,24 @@
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
"}}} "}}}
"FILETYPES AND SYNTAX: SETTINGS FOR FILETYPES AND ASSOCIATED SYNTAX {{{ "BEHAVIOUR: {{{
filetype plugin indent on set autochdir "change to a file's directory when it's opened
syntax on set history=250 "size of the undo history
set whichwrap=b,s,<,>,[,] "scrolling left/right off current line wraps to the next/previous
set smarttab expandtab autoindent tabstop=4 shiftwidth=4 "configure tabs
set hlsearch incsearch ignorecase smartcase "configure how search behaves
set timeoutlen=500 ttimeoutlen=0 "shorten the timeout length of escapes
"set given filenames to various filetypes "enable the auto-creation of missing folders in a save path
au BufNewFile,BufRead pacman.conf,yaourtrc setf sh function s:MakeNewDir(fullpath, buf)
au BufNewFile,BufRead cjdroute.conf,cjdmaid.conf setf json if empty(getbufvar(a:buf,'&buftype')) && a:fullpath!~#'\v^\w+\:\/'
au BufNewFile,BufRead *muttrc setf muttrc let dirpath=fnamemodify(a:fullpath,':h')
au BufNewFile,BufRead *ircd.conf setf javascript if !isdirectory(dirpath)|call mkdir(dirpath,'p')|endif
au BufNewFile,BufRead *.aspx,*.asmx,*.ascx,*.master setf aspnet endif
au BufNewFile,BufRead *.gradle setf groovy endfunction
augroup WriteDir
autocmd!
autocmd BufWritePre * :call s:MakeNewDir(expand('<afile>'),+expand('<abuf>'))
augroup END
"}}} "}}}
"GVIM: GUI CONFIG OPTIONS {{{
set guicursor+=a:blinkon0 "disable the blinking cursor
set guioptions=aegip "enable some good defaults for gvim
set guioptions+=lRb "enable scrollbars (right only when a split is present)
"}}} "}}}