2010-04-20 16:08:48 +00:00
|
|
|
|
" Modeline and Notes {
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" vim: set sw=4 ts=4 sts=4 et tw=78 foldmarker={,} foldlevel=0 foldmethod=marker spell:
|
2010-04-20 16:08:48 +00:00
|
|
|
|
"
|
2012-01-12 07:28:27 +00:00
|
|
|
|
" __ _ _____ _
|
|
|
|
|
" ___ _ __ / _/ |___ / __ __(_)_ __ ___
|
|
|
|
|
" / __| '_ \| |_| | |_ \ _____\ \ / /| | '_ ` _ \
|
|
|
|
|
" \__ \ |_) | _| |___) |_____|\ V / | | | | | | |
|
|
|
|
|
" |___/ .__/|_| |_|____/ \_/ |_|_| |_| |_|
|
|
|
|
|
" |_|
|
|
|
|
|
"
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" This is the personal .vimrc file of Steve Francia.
|
|
|
|
|
" While much of it is beneficial for general use, I would
|
|
|
|
|
" recommend picking out the parts you want and understand.
|
2010-04-20 16:08:48 +00:00
|
|
|
|
"
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" You can find me at http://spf13.com
|
2010-04-20 16:08:48 +00:00
|
|
|
|
" }
|
|
|
|
|
|
2010-10-02 12:25:10 +00:00
|
|
|
|
" Environment {
|
2013-01-05 07:59:43 +00:00
|
|
|
|
|
2013-12-01 04:13:18 +00:00
|
|
|
|
" Identify platform {
|
|
|
|
|
silent function! OSX()
|
|
|
|
|
return has('macunix')
|
|
|
|
|
endfunction
|
|
|
|
|
silent function! LINUX()
|
|
|
|
|
return has('unix') && !has('macunix') && !has('win32unix')
|
|
|
|
|
endfunction
|
|
|
|
|
silent function! WINDOWS()
|
2014-01-03 20:53:07 +00:00
|
|
|
|
return (has('win16') || has('win32') || has('win64'))
|
2013-12-01 04:13:18 +00:00
|
|
|
|
endfunction
|
|
|
|
|
" }
|
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" Basics {
|
2013-01-05 07:59:43 +00:00
|
|
|
|
set nocompatible " Must be first line
|
2013-12-01 04:13:18 +00:00
|
|
|
|
if !WINDOWS()
|
2013-06-30 10:20:25 +00:00
|
|
|
|
set shell=/bin/sh
|
|
|
|
|
endif
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" }
|
|
|
|
|
|
|
|
|
|
" Windows Compatible {
|
|
|
|
|
" On Windows, also use '.vim' instead of 'vimfiles'; this makes synchronization
|
2012-04-18 09:06:30 +00:00
|
|
|
|
" across (heterogeneous) systems easier.
|
2013-12-01 04:13:18 +00:00
|
|
|
|
if WINDOWS()
|
2011-12-10 20:10:06 +00:00
|
|
|
|
set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
|
|
|
|
|
endif
|
|
|
|
|
" }
|
2012-10-12 16:46:17 +00:00
|
|
|
|
|
2013-10-18 04:08:37 +00:00
|
|
|
|
" }
|
2011-03-02 18:57:03 +00:00
|
|
|
|
|
2013-10-18 04:08:37 +00:00
|
|
|
|
" Use before config if available {
|
|
|
|
|
if filereadable(expand("~/.vimrc.before"))
|
|
|
|
|
source ~/.vimrc.before
|
|
|
|
|
endif
|
2011-02-23 00:10:22 +00:00
|
|
|
|
" }
|
2010-04-23 21:07:12 +00:00
|
|
|
|
|
2013-09-06 22:25:29 +00:00
|
|
|
|
" Use bundles config {
|
|
|
|
|
if filereadable(expand("~/.vimrc.bundles"))
|
|
|
|
|
source ~/.vimrc.bundles
|
|
|
|
|
endif
|
2011-05-17 19:40:32 +00:00
|
|
|
|
" }
|
|
|
|
|
|
2010-04-20 16:08:48 +00:00
|
|
|
|
" General {
|
2013-01-05 07:59:43 +00:00
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
set background=dark " Assume a dark background
|
2013-12-01 04:13:31 +00:00
|
|
|
|
" if !has('gui')
|
2012-02-08 03:11:37 +00:00
|
|
|
|
"set term=$TERM " Make arrow and other keys work
|
2013-12-01 04:13:31 +00:00
|
|
|
|
" endif
|
2011-12-10 20:10:06 +00:00
|
|
|
|
filetype plugin indent on " Automatically detect file types.
|
2013-01-05 07:59:43 +00:00
|
|
|
|
syntax on " Syntax highlighting
|
|
|
|
|
set mouse=a " Automatically enable mouse usage
|
|
|
|
|
set mousehide " Hide the mouse cursor while typing
|
2011-12-10 20:10:06 +00:00
|
|
|
|
scriptencoding utf-8
|
2012-09-27 04:04:51 +00:00
|
|
|
|
|
2013-12-01 04:13:53 +00:00
|
|
|
|
if has('clipboard')
|
2014-02-19 22:02:28 +00:00
|
|
|
|
if has('unnamedplus') " When possible use + register for copy-paste
|
2013-12-01 04:13:53 +00:00
|
|
|
|
set clipboard=unnamedplus
|
|
|
|
|
else " On mac and Windows, use * register for copy-paste
|
|
|
|
|
set clipboard=unnamed
|
|
|
|
|
endif
|
2012-11-28 23:11:14 +00:00
|
|
|
|
endif
|
|
|
|
|
|
2012-09-27 04:04:51 +00:00
|
|
|
|
" Most prefer to automatically switch to the current file directory when
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" a new buffer is opened; to prevent this behavior, add the following to
|
2013-08-31 13:27:10 +00:00
|
|
|
|
" your .vimrc.before.local file:
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" let g:spf13_no_autochdir = 1
|
2012-09-27 04:04:51 +00:00
|
|
|
|
if !exists('g:spf13_no_autochdir')
|
|
|
|
|
autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9\]*://" | lcd %:p:h | endif
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" Always switch to the current file directory
|
2012-09-27 04:04:51 +00:00
|
|
|
|
endif
|
2011-02-23 00:10:22 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
"set autowrite " Automatically write a file when leaving a modified buffer
|
|
|
|
|
set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
|
|
|
|
|
set viewoptions=folds,options,cursor,unix,slash " Better Unix / Windows compatibility
|
|
|
|
|
set virtualedit=onemore " Allow for cursor beyond last character
|
|
|
|
|
set history=1000 " Store a ton of history (default is 20)
|
|
|
|
|
set spell " Spell checking on
|
|
|
|
|
set hidden " Allow buffer switching without saving
|
2011-06-20 14:24:59 +00:00
|
|
|
|
|
2013-06-22 03:55:05 +00:00
|
|
|
|
" Instead of reverting the cursor to the last position in the buffer, we
|
|
|
|
|
" set it to the first line when editing a git commit message
|
|
|
|
|
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
|
|
|
|
|
|
2013-09-04 10:40:33 +00:00
|
|
|
|
" http://vim.wikia.com/wiki/Restore_cursor_to_file_position_in_previous_editing_session
|
|
|
|
|
" Restore cursor to file position in previous editing session
|
|
|
|
|
" To disable this, add the following to your .vimrc.before.local file:
|
|
|
|
|
" let g:spf13_no_restore_cursor = 1
|
|
|
|
|
if !exists('g:spf13_no_restore_cursor')
|
|
|
|
|
function! ResCur()
|
|
|
|
|
if line("'\"") <= line("$")
|
|
|
|
|
normal! g`"
|
|
|
|
|
return 1
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
augroup resCur
|
|
|
|
|
autocmd!
|
|
|
|
|
autocmd BufWinEnter * call ResCur()
|
|
|
|
|
augroup END
|
|
|
|
|
endif
|
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" Setting up the directories {
|
2013-01-05 07:59:43 +00:00
|
|
|
|
set backup " Backups are nice ...
|
2012-02-15 20:19:28 +00:00
|
|
|
|
if has('persistent_undo')
|
2013-01-05 07:59:43 +00:00
|
|
|
|
set undofile " So is persistent undo ...
|
|
|
|
|
set undolevels=1000 " Maximum number of changes that can be undone
|
|
|
|
|
set undoreload=10000 " Maximum number lines to save for undo on a buffer reload
|
2012-02-15 20:19:28 +00:00
|
|
|
|
endif
|
2012-09-10 00:44:39 +00:00
|
|
|
|
|
2013-08-31 13:27:10 +00:00
|
|
|
|
" To disable views add the following to your .vimrc.before.local file:
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" let g:spf13_no_views = 1
|
|
|
|
|
if !exists('g:spf13_no_views')
|
|
|
|
|
" Add exclusions to mkview and loadview
|
|
|
|
|
" eg: *.*, svn-commit.tmp
|
|
|
|
|
let g:skipview_files = [
|
|
|
|
|
\ '\[example pattern\]'
|
|
|
|
|
\ ]
|
|
|
|
|
endif
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" }
|
2013-01-05 07:59:43 +00:00
|
|
|
|
|
2010-04-20 16:08:48 +00:00
|
|
|
|
" }
|
|
|
|
|
|
|
|
|
|
" Vim UI {
|
2013-01-05 07:59:43 +00:00
|
|
|
|
|
2012-04-18 09:06:30 +00:00
|
|
|
|
if filereadable(expand("~/.vim/bundle/vim-colors-solarized/colors/solarized.vim"))
|
2012-08-17 08:01:40 +00:00
|
|
|
|
let g:solarized_termcolors=256
|
2012-01-28 06:22:33 +00:00
|
|
|
|
let g:solarized_termtrans=1
|
2013-09-07 04:14:43 +00:00
|
|
|
|
let g:solarized_contrast="normal"
|
|
|
|
|
let g:solarized_visibility="normal"
|
2013-08-29 00:11:39 +00:00
|
|
|
|
color solarized " Load a colorscheme
|
|
|
|
|
endif
|
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
set tabpagemax=15 " Only show 15 tabs
|
|
|
|
|
set showmode " Display the current mode
|
2011-12-10 20:10:06 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
set cursorline " Highlight current line
|
2011-12-10 20:10:06 +00:00
|
|
|
|
|
2013-11-05 11:49:01 +00:00
|
|
|
|
highlight clear SignColumn " SignColumn should match background
|
|
|
|
|
highlight clear LineNr " Current line number row will have same background color in relative mode
|
2013-12-02 04:42:46 +00:00
|
|
|
|
let g:CSApprox_hook_post = ['hi clear SignColumn']
|
2013-08-29 00:11:58 +00:00
|
|
|
|
"highlight clear CursorLineNr " Remove highlight color from current line number
|
2013-03-06 04:16:59 +00:00
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
if has('cmdline_info')
|
2013-01-05 07:59:43 +00:00
|
|
|
|
set ruler " Show the ruler
|
|
|
|
|
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids
|
|
|
|
|
set showcmd " Show partial commands in status line and
|
|
|
|
|
" Selected characters/lines in visual mode
|
2011-12-10 20:10:06 +00:00
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if has('statusline')
|
2011-02-23 00:10:22 +00:00
|
|
|
|
set laststatus=2
|
2011-02-25 23:07:07 +00:00
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" Broken down into easily includeable segments
|
2013-01-05 07:59:43 +00:00
|
|
|
|
set statusline=%<%f\ " Filename
|
|
|
|
|
set statusline+=%w%h%m%r " Options
|
|
|
|
|
set statusline+=%{fugitive#statusline()} " Git Hotness
|
|
|
|
|
set statusline+=\ [%{&ff}/%Y] " Filetype
|
|
|
|
|
set statusline+=\ [%{getcwd()}] " Current dir
|
2011-12-10 20:10:06 +00:00
|
|
|
|
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
|
|
|
|
|
endif
|
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
set backspace=indent,eol,start " Backspace for dummies
|
2011-12-10 20:10:06 +00:00
|
|
|
|
set linespace=0 " No extra spaces between rows
|
|
|
|
|
set nu " Line numbers on
|
2013-01-05 07:59:43 +00:00
|
|
|
|
set showmatch " Show matching brackets/parenthesis
|
|
|
|
|
set incsearch " Find as you type search
|
|
|
|
|
set hlsearch " Highlight search terms
|
|
|
|
|
set winminheight=0 " Windows can be 0 line high
|
|
|
|
|
set ignorecase " Case insensitive search
|
|
|
|
|
set smartcase " Case sensitive when uc present
|
|
|
|
|
set wildmenu " Show list instead of just completing
|
|
|
|
|
set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
|
|
|
|
|
set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too
|
|
|
|
|
set scrolljump=5 " Lines to scroll when cursor leaves screen
|
|
|
|
|
set scrolloff=3 " Minimum lines to keep above and below cursor
|
|
|
|
|
set foldenable " Auto fold code
|
2011-04-25 12:20:57 +00:00
|
|
|
|
set list
|
2013-03-19 21:47:27 +00:00
|
|
|
|
set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace
|
2011-04-25 12:20:57 +00:00
|
|
|
|
|
2010-04-20 16:08:48 +00:00
|
|
|
|
" }
|
|
|
|
|
|
|
|
|
|
" Formatting {
|
2013-01-05 07:59:43 +00:00
|
|
|
|
|
2013-10-18 03:05:18 +00:00
|
|
|
|
set nowrap " Do not wrap long lines
|
2013-01-05 07:59:43 +00:00
|
|
|
|
set autoindent " Indent at the same level of the previous line
|
|
|
|
|
set shiftwidth=4 " Use indents of 4 spaces
|
|
|
|
|
set expandtab " Tabs are spaces, not tabs
|
|
|
|
|
set tabstop=4 " An indentation every four columns
|
|
|
|
|
set softtabstop=4 " Let backspace delete indent
|
2013-03-29 03:12:26 +00:00
|
|
|
|
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
|
|
|
|
|
set splitright " Puts new vsplit windows to the right of the current
|
|
|
|
|
set splitbelow " Puts new split windows to the bottom of the current
|
2013-01-05 07:59:43 +00:00
|
|
|
|
"set matchpairs+=<:> " Match, to be used with %
|
2011-12-10 20:10:06 +00:00
|
|
|
|
set pastetoggle=<F12> " pastetoggle (sane indentation on pastes)
|
|
|
|
|
"set comments=sl:/*,mb:*,elx:*/ " auto format comment blocks
|
|
|
|
|
" Remove trailing whitespaces and ^M chars
|
2013-10-12 20:03:17 +00:00
|
|
|
|
" To disable the stripping of whitespace, add the following to your
|
|
|
|
|
" .vimrc.before.local file:
|
|
|
|
|
" let g:spf13_keep_trailing_whitespace = 1
|
2014-04-29 17:27:31 +00:00
|
|
|
|
autocmd FileType c,cpp,java,go,php,javascript,python,twig,xml,yml,perl autocmd BufWritePre <buffer> if !exists('g:spf13_keep_trailing_whitespace') | call StripTrailingWhitespace() | endif
|
2014-03-31 20:25:32 +00:00
|
|
|
|
"autocmd FileType go autocmd BufWritePre <buffer> Fmt
|
2012-08-29 20:32:34 +00:00
|
|
|
|
autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
|
2013-06-21 11:21:43 +00:00
|
|
|
|
autocmd FileType haskell setlocal expandtab shiftwidth=2 softtabstop=2
|
2013-03-29 03:12:26 +00:00
|
|
|
|
" preceding line best in a plugin but here for now.
|
2013-07-09 02:49:10 +00:00
|
|
|
|
|
2013-06-27 19:09:50 +00:00
|
|
|
|
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
|
2013-01-05 07:59:43 +00:00
|
|
|
|
|
2013-06-24 12:27:13 +00:00
|
|
|
|
" Workaround vim-commentary for Haskell
|
|
|
|
|
autocmd FileType haskell setlocal commentstring=--\ %s
|
|
|
|
|
" Workaround broken colour highlighting in Haskell
|
|
|
|
|
autocmd FileType haskell setlocal nospell
|
2013-01-05 07:59:43 +00:00
|
|
|
|
|
2010-04-20 16:08:48 +00:00
|
|
|
|
" }
|
|
|
|
|
|
2011-02-23 00:10:22 +00:00
|
|
|
|
" Key (re)Mappings {
|
2010-04-20 16:08:48 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" The default leader is '\', but many people prefer ',' as it's in a standard
|
|
|
|
|
" location. To override this behavior and set it back to '\' (or any other
|
2013-08-31 13:27:10 +00:00
|
|
|
|
" character) add the following to your .vimrc.before.local file:
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" let g:spf13_leader='\'
|
2012-09-27 04:04:51 +00:00
|
|
|
|
if !exists('g:spf13_leader')
|
|
|
|
|
let mapleader = ','
|
|
|
|
|
else
|
|
|
|
|
let mapleader=g:spf13_leader
|
|
|
|
|
endif
|
2013-12-01 04:14:19 +00:00
|
|
|
|
if !exists('g:spf13_localleader')
|
|
|
|
|
let maplocalleader = '_'
|
|
|
|
|
else
|
|
|
|
|
let maplocalleader=g:spf13_localleader
|
|
|
|
|
endif
|
2010-10-08 12:41:13 +00:00
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" Easier moving in tabs and windows
|
2013-02-19 15:31:51 +00:00
|
|
|
|
" The lines conflict with the default digraph mapping of <C-K>
|
2013-08-29 00:11:58 +00:00
|
|
|
|
" If you prefer that functionality, add the following to your
|
|
|
|
|
" .vimrc.before.local file:
|
|
|
|
|
" let g:spf13_no_easyWindows = 1
|
2013-02-19 15:31:51 +00:00
|
|
|
|
if !exists('g:spf13_no_easyWindows')
|
|
|
|
|
map <C-J> <C-W>j<C-W>_
|
|
|
|
|
map <C-K> <C-W>k<C-W>_
|
|
|
|
|
map <C-L> <C-W>l<C-W>_
|
|
|
|
|
map <C-H> <C-W>h<C-W>_
|
|
|
|
|
endif
|
2011-12-11 06:34:50 +00:00
|
|
|
|
|
2011-04-25 12:20:57 +00:00
|
|
|
|
" Wrapped lines goes down/up to next row, rather than next line in file.
|
2013-07-16 19:32:54 +00:00
|
|
|
|
noremap j gj
|
|
|
|
|
noremap k gk
|
2011-04-25 12:20:57 +00:00
|
|
|
|
|
2014-02-05 00:16:58 +00:00
|
|
|
|
" End/Start of line motion keys act relative to row/wrap width in the
|
|
|
|
|
" presence of `:set wrap`, and relative to line for `:set nowrap`.
|
|
|
|
|
" Default vim behaviour is to act relative to text line in both cases
|
|
|
|
|
" If you prefer the default behaviour, add the following to your
|
|
|
|
|
" .vimrc.before.local file:
|
|
|
|
|
" let g:spf13_no_wrapRelMotion = 1
|
|
|
|
|
if !exists('g:spf13_no_wrapRelMotion')
|
|
|
|
|
" Same for 0, home, end, etc
|
|
|
|
|
function! WrapRelativeMotion(key, ...)
|
|
|
|
|
let vis_sel=""
|
|
|
|
|
if a:0
|
|
|
|
|
let vis_sel="gv"
|
|
|
|
|
endif
|
|
|
|
|
if &wrap
|
|
|
|
|
execute "normal!" vis_sel . "g" . a:key
|
|
|
|
|
else
|
|
|
|
|
execute "normal!" vis_sel . a:key
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
2014-02-05 11:04:22 +00:00
|
|
|
|
" Map g* keys in Normal, Operator-pending, and Visual+select
|
2014-02-05 11:51:12 +00:00
|
|
|
|
noremap $ :call WrapRelativeMotion("$")<CR>
|
|
|
|
|
noremap <End> :call WrapRelativeMotion("$")<CR>
|
|
|
|
|
noremap 0 :call WrapRelativeMotion("0")<CR>
|
|
|
|
|
noremap <Home> :call WrapRelativeMotion("0")<CR>
|
|
|
|
|
noremap ^ :call WrapRelativeMotion("^")<CR>
|
|
|
|
|
" Overwrite the operator pending $/<End> mappings from above
|
|
|
|
|
" to force inclusive motion with :execute normal!
|
2014-02-05 11:04:22 +00:00
|
|
|
|
onoremap $ v:call WrapRelativeMotion("$")<CR>
|
|
|
|
|
onoremap <End> v:call WrapRelativeMotion("$")<CR>
|
2014-02-05 11:51:12 +00:00
|
|
|
|
" Overwrite the Visual+select mode mappings from above
|
|
|
|
|
" to ensure the correct vis_sel flag is passed to function
|
2014-02-05 00:16:58 +00:00
|
|
|
|
vnoremap $ :<C-U>call WrapRelativeMotion("$", 1)<CR>
|
|
|
|
|
vnoremap <End> :<C-U>call WrapRelativeMotion("$", 1)<CR>
|
|
|
|
|
vnoremap 0 :<C-U>call WrapRelativeMotion("0", 1)<CR>
|
|
|
|
|
vnoremap <Home> :<C-U>call WrapRelativeMotion("0", 1)<CR>
|
|
|
|
|
vnoremap ^ :<C-U>call WrapRelativeMotion("^", 1)<CR>
|
|
|
|
|
endif
|
2013-10-13 22:03:11 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" The following two lines conflict with moving to top and
|
|
|
|
|
" bottom of the screen
|
|
|
|
|
" If you prefer that functionality, add the following to your
|
2013-08-31 13:27:10 +00:00
|
|
|
|
" .vimrc.before.local file:
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" let g:spf13_no_fastTabs = 1
|
2012-09-27 04:04:51 +00:00
|
|
|
|
if !exists('g:spf13_no_fastTabs')
|
|
|
|
|
map <S-H> gT
|
|
|
|
|
map <S-L> gt
|
2012-09-10 17:58:46 +00:00
|
|
|
|
endif
|
|
|
|
|
|
2012-09-27 04:04:51 +00:00
|
|
|
|
" Stupid shift key fixes
|
|
|
|
|
if !exists('g:spf13_no_keyfixes')
|
|
|
|
|
if has("user_commands")
|
|
|
|
|
command! -bang -nargs=* -complete=file E e<bang> <args>
|
|
|
|
|
command! -bang -nargs=* -complete=file W w<bang> <args>
|
|
|
|
|
command! -bang -nargs=* -complete=file Wq wq<bang> <args>
|
|
|
|
|
command! -bang -nargs=* -complete=file WQ wq<bang> <args>
|
|
|
|
|
command! -bang Wa wa<bang>
|
|
|
|
|
command! -bang WA wa<bang>
|
|
|
|
|
command! -bang Q q<bang>
|
|
|
|
|
command! -bang QA qa<bang>
|
|
|
|
|
command! -bang Qa qa<bang>
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
cmap Tabe tabe
|
|
|
|
|
endif
|
2011-12-10 20:10:06 +00:00
|
|
|
|
|
|
|
|
|
" Yank from the cursor to the end of the line, to be consistent with C and D.
|
|
|
|
|
nnoremap Y y$
|
2011-12-11 06:34:50 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" Code folding options
|
2011-12-10 20:10:06 +00:00
|
|
|
|
nmap <leader>f0 :set foldlevel=0<CR>
|
|
|
|
|
nmap <leader>f1 :set foldlevel=1<CR>
|
|
|
|
|
nmap <leader>f2 :set foldlevel=2<CR>
|
|
|
|
|
nmap <leader>f3 :set foldlevel=3<CR>
|
|
|
|
|
nmap <leader>f4 :set foldlevel=4<CR>
|
|
|
|
|
nmap <leader>f5 :set foldlevel=5<CR>
|
|
|
|
|
nmap <leader>f6 :set foldlevel=6<CR>
|
|
|
|
|
nmap <leader>f7 :set foldlevel=7<CR>
|
|
|
|
|
nmap <leader>f8 :set foldlevel=8<CR>
|
|
|
|
|
nmap <leader>f9 :set foldlevel=9<CR>
|
2010-05-16 03:57:04 +00:00
|
|
|
|
|
2013-09-05 06:56:54 +00:00
|
|
|
|
" Most prefer to toggle search highlighting rather than clear the current
|
|
|
|
|
" search results. To clear search highlighting rather than toggle it on
|
|
|
|
|
" and off, add the following to your .vimrc.before.local file:
|
|
|
|
|
" let g:spf13_clear_search_highlight = 1
|
|
|
|
|
if exists('g:spf13_clear_search_highlight')
|
|
|
|
|
nmap <silent> <leader>/ :nohlsearch<CR>
|
|
|
|
|
else
|
|
|
|
|
nmap <silent> <leader>/ :set invhlsearch<CR>
|
|
|
|
|
endif
|
|
|
|
|
|
2011-04-25 12:20:57 +00:00
|
|
|
|
|
2013-03-29 03:12:26 +00:00
|
|
|
|
" Find merge conflict markers
|
|
|
|
|
map <leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>
|
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" Shortcuts
|
|
|
|
|
" Change Working Directory to that of the current file
|
2010-05-16 03:57:04 +00:00
|
|
|
|
cmap cwd lcd %:p:h
|
2011-12-10 20:10:06 +00:00
|
|
|
|
cmap cd. lcd %:p:h
|
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" Visual shifting (does not exit Visual mode)
|
2011-12-10 20:10:06 +00:00
|
|
|
|
vnoremap < <gv
|
2012-04-18 09:06:30 +00:00
|
|
|
|
vnoremap > >gv
|
2011-12-10 20:10:06 +00:00
|
|
|
|
|
2013-03-29 03:12:26 +00:00
|
|
|
|
" Allow using the repeat operator with a visual selection (!)
|
|
|
|
|
" http://stackoverflow.com/a/8064607/127816
|
|
|
|
|
vnoremap . :normal .<CR>
|
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" For when you forget to sudo.. Really Write the file.
|
|
|
|
|
cmap w!! w !sudo tee % >/dev/null
|
2012-01-28 06:22:33 +00:00
|
|
|
|
|
|
|
|
|
" Some helpers to edit mode
|
|
|
|
|
" http://vimcasts.org/e/14
|
|
|
|
|
cnoremap %% <C-R>=expand('%:h').'/'<cr>
|
|
|
|
|
map <leader>ew :e %%
|
|
|
|
|
map <leader>es :sp %%
|
|
|
|
|
map <leader>ev :vsp %%
|
|
|
|
|
map <leader>et :tabe %%
|
|
|
|
|
|
|
|
|
|
" Adjust viewports to the same size
|
|
|
|
|
map <Leader>= <C-w>=
|
2012-04-22 10:05:43 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" Map <Leader>ff to display all lines with keyword under cursor
|
2012-11-10 17:25:02 +00:00
|
|
|
|
" and ask which one to jump to
|
2012-11-12 07:56:12 +00:00
|
|
|
|
nmap <Leader>ff [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR>
|
2012-11-10 17:25:02 +00:00
|
|
|
|
|
2012-04-22 10:05:43 +00:00
|
|
|
|
" Easier horizontal scrolling
|
|
|
|
|
map zl zL
|
|
|
|
|
map zh zH
|
2013-01-05 07:59:43 +00:00
|
|
|
|
|
2014-04-02 13:16:55 +00:00
|
|
|
|
" Easier formatting
|
|
|
|
|
nnoremap <silent> <leader>q gwip
|
|
|
|
|
|
2013-11-27 02:59:28 +00:00
|
|
|
|
" FIXME: Revert this f70be548
|
2013-11-22 08:56:31 +00:00
|
|
|
|
" fullscreen mode for GVIM and Terminal, need 'wmctrl' in you PATH
|
|
|
|
|
map <silent> <F11> :call system("wmctrl -ir " . v:windowid . " -b toggle,fullscreen")<CR>
|
|
|
|
|
|
2010-04-20 16:08:48 +00:00
|
|
|
|
" }
|
|
|
|
|
|
|
|
|
|
" Plugins {
|
|
|
|
|
|
2014-04-02 13:16:55 +00:00
|
|
|
|
" TextObj Sentence {
|
|
|
|
|
if count(g:spf13_bundle_groups, 'writing')
|
|
|
|
|
augroup textobj_sentence
|
|
|
|
|
autocmd!
|
|
|
|
|
autocmd FileType markdown call textobj#sentence#init()
|
|
|
|
|
autocmd FileType textile call textobj#sentence#init()
|
|
|
|
|
autocmd FileType text call textobj#sentence#init()
|
|
|
|
|
augroup END
|
|
|
|
|
endif
|
|
|
|
|
" }
|
|
|
|
|
|
|
|
|
|
" TextObj Quote {
|
|
|
|
|
if count(g:spf13_bundle_groups, 'writing')
|
|
|
|
|
augroup textobj_quote
|
|
|
|
|
autocmd!
|
|
|
|
|
autocmd FileType markdown call textobj#quote#init()
|
|
|
|
|
autocmd FileType textile call textobj#quote#init()
|
|
|
|
|
autocmd FileType text call textobj#quote#init({'educate': 0})
|
|
|
|
|
augroup END
|
|
|
|
|
endif
|
|
|
|
|
" }
|
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" PIV {
|
|
|
|
|
let g:DisableAutoPHPFolding = 0
|
2012-01-27 03:52:28 +00:00
|
|
|
|
let g:PIVAutoClose = 0
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" }
|
2011-05-20 12:36:38 +00:00
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" Misc {
|
|
|
|
|
let g:NERDShutUp=1
|
|
|
|
|
let b:match_ignorecase = 1
|
|
|
|
|
" }
|
|
|
|
|
|
|
|
|
|
" OmniComplete {
|
2014-01-27 10:17:56 +00:00
|
|
|
|
" To disable omni complete, add the following to your .vimrc.before.local file:
|
|
|
|
|
" let g:spf13_no_omni_complete = 1
|
|
|
|
|
if !exists('g:spf13_no_omni_complete')
|
|
|
|
|
if has("autocmd") && exists("+omnifunc")
|
|
|
|
|
autocmd Filetype *
|
|
|
|
|
\if &omnifunc == "" |
|
|
|
|
|
\setlocal omnifunc=syntaxcomplete#Complete |
|
|
|
|
|
\endif
|
|
|
|
|
endif
|
2010-04-20 16:08:48 +00:00
|
|
|
|
|
2014-01-27 10:17:56 +00:00
|
|
|
|
hi Pmenu guifg=#000000 guibg=#F8F8F8 ctermfg=black ctermbg=Lightgray
|
|
|
|
|
hi PmenuSbar guifg=#8A95A7 guibg=#F8F8F8 gui=NONE ctermfg=darkcyan ctermbg=lightgray cterm=NONE
|
|
|
|
|
hi PmenuThumb guifg=#F8F8F8 guibg=#8A95A7 gui=NONE ctermfg=lightgray ctermbg=darkcyan cterm=NONE
|
|
|
|
|
|
|
|
|
|
" Some convenient mappings
|
|
|
|
|
inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>"
|
|
|
|
|
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
|
|
|
|
|
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
|
|
|
|
|
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
|
|
|
|
|
inoremap <expr> <C-d> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<C-d>"
|
|
|
|
|
inoremap <expr> <C-u> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<C-u>"
|
|
|
|
|
|
|
|
|
|
" Automatically open and close the popup menu / preview window
|
|
|
|
|
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
|
|
|
|
|
set completeopt=menu,preview,longest
|
|
|
|
|
endif
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" }
|
2011-05-20 12:36:38 +00:00
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" Ctags {
|
|
|
|
|
set tags=./tags;/,~/.vimtags
|
2013-03-29 03:12:26 +00:00
|
|
|
|
|
|
|
|
|
" Make tags placed in .git/tags file available in all levels of a repository
|
|
|
|
|
let gitroot = substitute(system('git rev-parse --show-toplevel'), '[\n\r]', '', 'g')
|
|
|
|
|
if gitroot != ''
|
|
|
|
|
let &tags = &tags . ',' . gitroot . '/.git/tags'
|
|
|
|
|
endif
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" }
|
2010-07-08 22:50:44 +00:00
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" AutoCloseTag {
|
2011-05-18 22:11:40 +00:00
|
|
|
|
" Make it so AutoCloseTag works for xml and xhtml files as well
|
|
|
|
|
au FileType xhtml,xml ru ftplugin/html/autoclosetag.vim
|
|
|
|
|
nmap <Leader>ac <Plug>ToggleAutoCloseMappings
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" }
|
2010-04-20 16:08:48 +00:00
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" SnipMate {
|
|
|
|
|
" Setting the author var
|
2011-02-23 00:10:22 +00:00
|
|
|
|
" If forking, please overwrite in your .vimrc.local file
|
2011-12-10 20:10:06 +00:00
|
|
|
|
let g:snips_author = 'Steve Francia <steve.francia@gmail.com>'
|
|
|
|
|
" }
|
|
|
|
|
|
|
|
|
|
" NerdTree {
|
2014-01-20 16:47:54 +00:00
|
|
|
|
map <C-e> <plug>NERDTreeTabsToggle<CR>
|
2011-12-10 20:10:06 +00:00
|
|
|
|
map <leader>e :NERDTreeFind<CR>
|
|
|
|
|
nmap <leader>nt :NERDTreeFind<CR>
|
|
|
|
|
|
|
|
|
|
let NERDTreeShowBookmarks=1
|
|
|
|
|
let NERDTreeIgnore=['\.pyc', '\~$', '\.swo$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr']
|
|
|
|
|
let NERDTreeChDirMode=0
|
|
|
|
|
let NERDTreeQuitOnOpen=1
|
2012-09-27 17:14:44 +00:00
|
|
|
|
let NERDTreeMouseMode=2
|
2011-12-10 20:10:06 +00:00
|
|
|
|
let NERDTreeShowHidden=1
|
|
|
|
|
let NERDTreeKeepTreeInNewTab=1
|
2012-09-27 17:41:30 +00:00
|
|
|
|
let g:nerdtree_tabs_open_on_gui_startup=0
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" }
|
2011-05-20 12:36:38 +00:00
|
|
|
|
|
2011-05-05 14:24:50 +00:00
|
|
|
|
" Tabularize {
|
2012-12-22 19:27:09 +00:00
|
|
|
|
nmap <Leader>a& :Tabularize /&<CR>
|
|
|
|
|
vmap <Leader>a& :Tabularize /&<CR>
|
2012-10-15 18:04:33 +00:00
|
|
|
|
nmap <Leader>a= :Tabularize /=<CR>
|
|
|
|
|
vmap <Leader>a= :Tabularize /=<CR>
|
|
|
|
|
nmap <Leader>a: :Tabularize /:<CR>
|
|
|
|
|
vmap <Leader>a: :Tabularize /:<CR>
|
|
|
|
|
nmap <Leader>a:: :Tabularize /:\zs<CR>
|
|
|
|
|
vmap <Leader>a:: :Tabularize /:\zs<CR>
|
|
|
|
|
nmap <Leader>a, :Tabularize /,<CR>
|
|
|
|
|
vmap <Leader>a, :Tabularize /,<CR>
|
2013-09-19 19:37:55 +00:00
|
|
|
|
nmap <Leader>a,, :Tabularize /,\zs<CR>
|
|
|
|
|
vmap <Leader>a,, :Tabularize /,\zs<CR>
|
2012-10-15 18:04:33 +00:00
|
|
|
|
nmap <Leader>a<Bar> :Tabularize /<Bar><CR>
|
|
|
|
|
vmap <Leader>a<Bar> :Tabularize /<Bar><CR>
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" }
|
2011-05-05 14:24:50 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" Session List {
|
2011-12-10 20:10:06 +00:00
|
|
|
|
set sessionoptions=blank,buffers,curdir,folds,tabpages,winsize
|
|
|
|
|
nmap <leader>sl :SessionList<CR>
|
|
|
|
|
nmap <leader>ss :SessionSave<CR>
|
2013-12-02 17:14:33 +00:00
|
|
|
|
nmap <leader>sc :SessionClose<CR>
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" }
|
2011-12-10 20:10:06 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" JSON {
|
2011-12-10 20:10:06 +00:00
|
|
|
|
nmap <leader>jt <Esc>:%!python -m json.tool<CR><Esc>:set filetype=json<CR>
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" }
|
2012-01-09 20:04:38 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" PyMode {
|
2014-03-27 06:57:29 +00:00
|
|
|
|
" Disable if python support not present
|
|
|
|
|
if !has('python')
|
|
|
|
|
let g:pymode = 0
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
let g:pymode_lint_checkers = ['pyflakes']
|
|
|
|
|
let g:pymode_trim_whitespaces = 0
|
2013-02-09 16:24:36 +00:00
|
|
|
|
let g:pymode_options = 0
|
2014-03-27 06:57:29 +00:00
|
|
|
|
let g:pymode_rope = 0
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" }
|
2012-01-09 20:04:38 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" ctrlp {
|
2013-05-04 09:25:12 +00:00
|
|
|
|
let g:ctrlp_working_path_mode = 'ra'
|
2012-01-28 06:22:33 +00:00
|
|
|
|
nnoremap <silent> <D-t> :CtrlP<CR>
|
|
|
|
|
nnoremap <silent> <D-r> :CtrlPMRU<CR>
|
2012-01-12 07:28:27 +00:00
|
|
|
|
let g:ctrlp_custom_ignore = {
|
|
|
|
|
\ 'dir': '\.git$\|\.hg$\|\.svn$',
|
2013-05-04 09:25:12 +00:00
|
|
|
|
\ 'file': '\.exe$\|\.so$\|\.dll$\|\.pyc$' }
|
2012-12-05 22:48:29 +00:00
|
|
|
|
|
2013-06-19 17:01:46 +00:00
|
|
|
|
" On Windows use "dir" as fallback command.
|
2014-01-03 20:53:07 +00:00
|
|
|
|
if WINDOWS()
|
2013-12-01 04:15:06 +00:00
|
|
|
|
let s:ctrlp_fallback = 'dir %s /-n /b /s /a-d'
|
|
|
|
|
elseif executable('ag')
|
|
|
|
|
let s:ctrlp_fallback = 'ag %s --nocolor -l -g ""'
|
2014-06-03 10:38:50 +00:00
|
|
|
|
elseif executable('ack-grep')
|
|
|
|
|
let s:ctrlp_fallback = 'ack-grep %s --nocolor -f'
|
2013-12-01 04:15:06 +00:00
|
|
|
|
elseif executable('ack')
|
|
|
|
|
let s:ctrlp_fallback = 'ack %s --nocolor -f'
|
2013-06-19 17:01:46 +00:00
|
|
|
|
else
|
2013-12-01 04:15:06 +00:00
|
|
|
|
let s:ctrlp_fallback = 'find %s -type f'
|
2013-06-19 17:01:46 +00:00
|
|
|
|
endif
|
2013-12-01 04:15:06 +00:00
|
|
|
|
let g:ctrlp_user_command = {
|
|
|
|
|
\ 'types': {
|
|
|
|
|
\ 1: ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others'],
|
|
|
|
|
\ 2: ['.hg', 'hg --cwd %s locate -I .'],
|
|
|
|
|
\ },
|
|
|
|
|
\ 'fallback': s:ctrlp_fallback
|
|
|
|
|
\ }
|
2014-03-27 06:57:29 +00:00
|
|
|
|
|
|
|
|
|
" CtrlP extensions
|
|
|
|
|
let g:ctrlp_extensions = ['funky']
|
|
|
|
|
|
|
|
|
|
"funky
|
|
|
|
|
nnoremap <Leader>fu :CtrlPFunky<Cr>
|
2013-01-05 07:59:43 +00:00
|
|
|
|
"}
|
2012-01-28 06:22:33 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" TagBar {
|
2012-01-28 06:22:33 +00:00
|
|
|
|
nnoremap <silent> <leader>tt :TagbarToggle<CR>
|
2013-04-05 04:32:52 +00:00
|
|
|
|
|
|
|
|
|
" If using go please install the gotags program using the following
|
|
|
|
|
" go install github.com/jstemmer/gotags
|
|
|
|
|
" And make sure gotags is in your path
|
|
|
|
|
let g:tagbar_type_go = {
|
|
|
|
|
\ 'ctagstype' : 'go',
|
|
|
|
|
\ 'kinds' : [ 'p:package', 'i:imports:1', 'c:constants', 'v:variables',
|
|
|
|
|
\ 't:types', 'n:interfaces', 'w:fields', 'e:embedded', 'm:methods',
|
|
|
|
|
\ 'r:constructor', 'f:functions' ],
|
|
|
|
|
\ 'sro' : '.',
|
|
|
|
|
\ 'kind2scope' : { 't' : 'ctype', 'n' : 'ntype' },
|
|
|
|
|
\ 'scope2kind' : { 'ctype' : 't', 'ntype' : 'n' },
|
|
|
|
|
\ 'ctagsbin' : 'gotags',
|
|
|
|
|
\ 'ctagsargs' : '-sort -silent'
|
|
|
|
|
\ }
|
2013-01-05 07:59:43 +00:00
|
|
|
|
"}
|
2012-01-28 06:22:33 +00:00
|
|
|
|
|
2012-02-27 14:20:23 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" Fugitive {
|
2012-01-28 06:22:33 +00:00
|
|
|
|
nnoremap <silent> <leader>gs :Gstatus<CR>
|
|
|
|
|
nnoremap <silent> <leader>gd :Gdiff<CR>
|
|
|
|
|
nnoremap <silent> <leader>gc :Gcommit<CR>
|
|
|
|
|
nnoremap <silent> <leader>gb :Gblame<CR>
|
|
|
|
|
nnoremap <silent> <leader>gl :Glog<CR>
|
|
|
|
|
nnoremap <silent> <leader>gp :Git push<CR>
|
2013-11-05 11:49:01 +00:00
|
|
|
|
nnoremap <silent> <leader>gr :Gread<CR>
|
|
|
|
|
nnoremap <silent> <leader>gw :Gwrite<CR>
|
2013-08-26 18:26:42 +00:00
|
|
|
|
nnoremap <silent> <leader>ge :Gedit<CR>
|
2013-12-01 04:15:59 +00:00
|
|
|
|
" Mnemonic _i_nteractive
|
|
|
|
|
nnoremap <silent> <leader>gi :Git add -p %<CR>
|
2013-11-05 11:49:01 +00:00
|
|
|
|
nnoremap <silent> <leader>gg :SignifyToggle<CR>
|
2013-01-05 07:59:43 +00:00
|
|
|
|
"}
|
2014-02-11 15:16:57 +00:00
|
|
|
|
|
2013-09-02 22:49:28 +00:00
|
|
|
|
" YouCompleteMe {
|
|
|
|
|
if count(g:spf13_bundle_groups, 'youcompleteme')
|
|
|
|
|
let g:acp_enableAtStartup = 0
|
|
|
|
|
|
2013-09-05 03:12:20 +00:00
|
|
|
|
" enable completion from tags
|
|
|
|
|
let g:ycm_collect_identifiers_from_tags_files = 1
|
2013-09-02 22:49:28 +00:00
|
|
|
|
|
2013-09-05 03:12:20 +00:00
|
|
|
|
" remap Ultisnips for compatibility for YCM
|
|
|
|
|
let g:UltiSnipsExpandTrigger = '<C-j>'
|
|
|
|
|
let g:UltiSnipsJumpForwardTrigger = '<C-j>'
|
|
|
|
|
let g:UltiSnipsJumpBackwardTrigger = '<C-k>'
|
2014-02-11 15:16:57 +00:00
|
|
|
|
|
2013-09-02 22:49:28 +00:00
|
|
|
|
" Enable omni completion.
|
|
|
|
|
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
|
|
|
|
|
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
|
|
|
|
|
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
|
|
|
|
|
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
|
|
|
|
|
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
|
|
|
|
|
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
|
|
|
|
|
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
|
|
|
|
|
|
|
|
|
|
" Haskell post write lint and check with ghcmod
|
|
|
|
|
" $ `cabal install ghcmod` if missing and ensure
|
|
|
|
|
" ~/.cabal/bin is in your $PATH.
|
|
|
|
|
if !executable("ghcmod")
|
|
|
|
|
autocmd BufWritePost *.hs GhcModCheckAndLintAsync
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
" For snippet_complete marker.
|
2014-02-01 01:26:17 +00:00
|
|
|
|
if !exists("g:spf13_no_conceal")
|
|
|
|
|
if has('conceal')
|
|
|
|
|
set conceallevel=2 concealcursor=i
|
|
|
|
|
endif
|
2013-09-02 22:49:28 +00:00
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
" Disable the neosnippet preview candidate window
|
|
|
|
|
" When enabled, there can be too much visual noise
|
|
|
|
|
" especially when splits are used.
|
|
|
|
|
set completeopt-=preview
|
|
|
|
|
endif
|
|
|
|
|
" }
|
2012-01-27 03:52:28 +00:00
|
|
|
|
|
2013-07-29 15:02:39 +00:00
|
|
|
|
" neocomplete {
|
|
|
|
|
if count(g:spf13_bundle_groups, 'neocomplete')
|
|
|
|
|
let g:acp_enableAtStartup = 0
|
2013-07-30 20:23:20 +00:00
|
|
|
|
let g:neocomplete#enable_at_startup = 1
|
|
|
|
|
let g:neocomplete#enable_smart_case = 1
|
|
|
|
|
let g:neocomplete#enable_auto_delimiter = 1
|
|
|
|
|
let g:neocomplete#max_list = 15
|
|
|
|
|
let g:neocomplete#force_overwrite_completefunc = 1
|
2013-07-29 15:02:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" Define dictionary.
|
2013-07-30 20:23:20 +00:00
|
|
|
|
let g:neocomplete#sources#dictionary#dictionaries = {
|
2013-07-29 15:02:39 +00:00
|
|
|
|
\ 'default' : '',
|
|
|
|
|
\ 'vimshell' : $HOME.'/.vimshell_hist',
|
|
|
|
|
\ 'scheme' : $HOME.'/.gosh_completions'
|
|
|
|
|
\ }
|
|
|
|
|
|
|
|
|
|
" Define keyword.
|
2013-07-30 20:23:20 +00:00
|
|
|
|
if !exists('g:neocomplete#keyword_patterns')
|
|
|
|
|
let g:neocomplete#keyword_patterns = {}
|
2013-07-29 15:02:39 +00:00
|
|
|
|
endif
|
2013-07-30 20:23:20 +00:00
|
|
|
|
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
|
2013-07-29 15:02:39 +00:00
|
|
|
|
|
2013-08-29 00:11:58 +00:00
|
|
|
|
" Plugin key-mappings {
|
|
|
|
|
" These two lines conflict with the default digraph mapping of <C-K>
|
|
|
|
|
if !exists('g:spf13_no_neosnippet_expand')
|
|
|
|
|
imap <C-k> <Plug>(neosnippet_expand_or_jump)
|
|
|
|
|
smap <C-k> <Plug>(neosnippet_expand_or_jump)
|
|
|
|
|
endif
|
2013-11-30 01:22:23 +00:00
|
|
|
|
if exists('g:spf13_noninvasive_completion')
|
|
|
|
|
iunmap <CR>
|
|
|
|
|
" <ESC> takes you out of insert mode
|
|
|
|
|
inoremap <expr> <Esc> pumvisible() ? "\<C-y>\<Esc>" : "\<Esc>"
|
|
|
|
|
" <CR> accepts first, then sends the <CR>
|
|
|
|
|
inoremap <expr> <CR> pumvisible() ? "\<C-y>\<CR>" : "\<CR>"
|
|
|
|
|
" <Down> and <Up> cycle like <Tab> and <S-Tab>
|
|
|
|
|
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
|
|
|
|
|
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
|
|
|
|
|
" Jump up and down the list
|
|
|
|
|
inoremap <expr> <C-d> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<C-d>"
|
|
|
|
|
inoremap <expr> <C-u> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<C-u>"
|
|
|
|
|
else
|
2014-03-31 20:24:39 +00:00
|
|
|
|
" <C-k> Complete Snippet
|
|
|
|
|
" <C-k> Jump to next snippet point
|
2013-11-30 01:22:23 +00:00
|
|
|
|
imap <silent><expr><C-k> neosnippet#expandable() ?
|
|
|
|
|
\ "\<Plug>(neosnippet_expand_or_jump)" : (pumvisible() ?
|
2014-01-16 15:34:38 +00:00
|
|
|
|
\ "\<C-e>" : "\<Plug>(neosnippet_expand_or_jump)")
|
2013-11-30 01:22:23 +00:00
|
|
|
|
smap <TAB> <Right><Plug>(neosnippet_jump_or_expand)
|
2013-08-29 00:11:58 +00:00
|
|
|
|
|
2013-10-18 04:09:59 +00:00
|
|
|
|
inoremap <expr><C-g> neocomplete#undo_completion()
|
|
|
|
|
inoremap <expr><C-l> neocomplete#complete_common_string()
|
2014-03-31 20:24:39 +00:00
|
|
|
|
"inoremap <expr><CR> neocomplete#complete_common_string()
|
2013-08-29 00:11:58 +00:00
|
|
|
|
|
2013-10-18 04:09:59 +00:00
|
|
|
|
" <CR>: close popup
|
|
|
|
|
" <s-CR>: close popup and save indent.
|
|
|
|
|
inoremap <expr><s-CR> pumvisible() ? neocomplete#close_popup()"\<CR>" : "\<CR>"
|
2014-03-31 20:24:39 +00:00
|
|
|
|
"inoremap <expr><CR> pumvisible() ? neocomplete#close_popup() : "\<CR>"
|
|
|
|
|
|
|
|
|
|
function! CleverCr()
|
|
|
|
|
if pumvisible()
|
|
|
|
|
if neosnippet#expandable()
|
|
|
|
|
let exp = "\<Plug>(neosnippet_expand)"
|
|
|
|
|
return exp . neocomplete#close_popup()
|
|
|
|
|
else
|
|
|
|
|
return neocomplete#close_popup()
|
|
|
|
|
endif
|
|
|
|
|
else
|
|
|
|
|
return "\<CR>"
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
" <CR> close popup and save indent or expand snippet
|
|
|
|
|
imap <expr> <CR> CleverCr()
|
2013-10-18 04:09:59 +00:00
|
|
|
|
" <C-h>, <BS>: close popup and delete backword char.
|
|
|
|
|
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
|
|
|
|
|
inoremap <expr><C-y> neocomplete#close_popup()
|
|
|
|
|
endif
|
2013-08-29 00:11:58 +00:00
|
|
|
|
" <TAB>: completion.
|
|
|
|
|
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
|
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<TAB>"
|
2014-03-31 20:24:39 +00:00
|
|
|
|
|
|
|
|
|
" Courtesy of Matteo Cavalleri
|
|
|
|
|
|
|
|
|
|
function! CleverTab()
|
|
|
|
|
if pumvisible()
|
|
|
|
|
return "\<C-n>"
|
|
|
|
|
endif
|
|
|
|
|
let substr = strpart(getline('.'), 0, col('.') - 1)
|
|
|
|
|
let substr = matchstr(substr, '[^ \t]*$')
|
|
|
|
|
if strlen(substr) == 0
|
|
|
|
|
" nothing to match on empty string
|
|
|
|
|
return "\<Tab>"
|
|
|
|
|
else
|
|
|
|
|
" existing text matching
|
|
|
|
|
if neosnippet#expandable_or_jumpable()
|
|
|
|
|
return "\<Plug>(neosnippet_expand_or_jump)"
|
|
|
|
|
else
|
|
|
|
|
return neocomplete#start_manual_complete()
|
|
|
|
|
endif
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
imap <expr> <Tab> CleverTab()
|
2013-08-29 00:11:58 +00:00
|
|
|
|
" }
|
2013-07-29 15:02:39 +00:00
|
|
|
|
|
|
|
|
|
" Enable heavy omni completion.
|
2013-07-30 20:23:20 +00:00
|
|
|
|
if !exists('g:neocomplete#sources#omni#input_patterns')
|
|
|
|
|
let g:neocomplete#sources#omni#input_patterns = {}
|
2013-07-29 15:02:39 +00:00
|
|
|
|
endif
|
2013-07-30 20:23:20 +00:00
|
|
|
|
let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
|
|
|
|
|
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
|
|
|
|
|
let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
|
|
|
|
|
let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
|
|
|
|
|
let g:neocomplete#sources#omni#input_patterns.ruby = '[^. *\t]\.\h\w*\|\h\w*::'
|
2013-07-29 15:02:39 +00:00
|
|
|
|
" }
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" neocomplcache {
|
2013-11-30 01:45:24 +00:00
|
|
|
|
elseif count(g:spf13_bundle_groups, 'neocomplcache')
|
2013-06-06 08:20:19 +00:00
|
|
|
|
let g:acp_enableAtStartup = 0
|
|
|
|
|
let g:neocomplcache_enable_at_startup = 1
|
|
|
|
|
let g:neocomplcache_enable_camel_case_completion = 1
|
|
|
|
|
let g:neocomplcache_enable_smart_case = 1
|
|
|
|
|
let g:neocomplcache_enable_underbar_completion = 1
|
|
|
|
|
let g:neocomplcache_enable_auto_delimiter = 1
|
|
|
|
|
let g:neocomplcache_max_list = 15
|
|
|
|
|
let g:neocomplcache_force_overwrite_completefunc = 1
|
|
|
|
|
|
|
|
|
|
" Define dictionary.
|
|
|
|
|
let g:neocomplcache_dictionary_filetype_lists = {
|
|
|
|
|
\ 'default' : '',
|
|
|
|
|
\ 'vimshell' : $HOME.'/.vimshell_hist',
|
|
|
|
|
\ 'scheme' : $HOME.'/.gosh_completions'
|
|
|
|
|
\ }
|
|
|
|
|
|
|
|
|
|
" Define keyword.
|
|
|
|
|
if !exists('g:neocomplcache_keyword_patterns')
|
|
|
|
|
let g:neocomplcache_keyword_patterns = {}
|
|
|
|
|
endif
|
|
|
|
|
let g:neocomplcache_keyword_patterns._ = '\h\w*'
|
|
|
|
|
|
2013-08-29 00:11:58 +00:00
|
|
|
|
" Plugin key-mappings {
|
|
|
|
|
" These two lines conflict with the default digraph mapping of <C-K>
|
2013-11-30 01:30:59 +00:00
|
|
|
|
imap <C-k> <Plug>(neosnippet_expand_or_jump)
|
|
|
|
|
smap <C-k> <Plug>(neosnippet_expand_or_jump)
|
|
|
|
|
if exists('g:spf13_noninvasive_completion')
|
|
|
|
|
iunmap <CR>
|
|
|
|
|
" <ESC> takes you out of insert mode
|
|
|
|
|
inoremap <expr> <Esc> pumvisible() ? "\<C-y>\<Esc>" : "\<Esc>"
|
|
|
|
|
" <CR> accepts first, then sends the <CR>
|
|
|
|
|
inoremap <expr> <CR> pumvisible() ? "\<C-y>\<CR>" : "\<CR>"
|
|
|
|
|
" <Down> and <Up> cycle like <Tab> and <S-Tab>
|
|
|
|
|
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
|
|
|
|
|
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
|
|
|
|
|
" Jump up and down the list
|
|
|
|
|
inoremap <expr> <C-d> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<C-d>"
|
|
|
|
|
inoremap <expr> <C-u> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<C-u>"
|
|
|
|
|
else
|
|
|
|
|
imap <silent><expr><C-k> neosnippet#expandable() ?
|
|
|
|
|
\ "\<Plug>(neosnippet_expand_or_jump)" : (pumvisible() ?
|
2014-01-16 15:34:38 +00:00
|
|
|
|
\ "\<C-e>" : "\<Plug>(neosnippet_expand_or_jump)")
|
2013-11-30 01:30:59 +00:00
|
|
|
|
smap <TAB> <Right><Plug>(neosnippet_jump_or_expand)
|
2013-08-29 00:11:58 +00:00
|
|
|
|
|
2013-10-18 04:09:59 +00:00
|
|
|
|
inoremap <expr><C-g> neocomplcache#undo_completion()
|
|
|
|
|
inoremap <expr><C-l> neocomplcache#complete_common_string()
|
2014-03-31 20:24:39 +00:00
|
|
|
|
"inoremap <expr><CR> neocomplcache#complete_common_string()
|
|
|
|
|
|
|
|
|
|
function! CleverCr()
|
|
|
|
|
if pumvisible()
|
|
|
|
|
if neosnippet#expandable()
|
|
|
|
|
let exp = "\<Plug>(neosnippet_expand)"
|
|
|
|
|
return exp . neocomplcache#close_popup()
|
|
|
|
|
else
|
|
|
|
|
return neocomplcache#close_popup()
|
|
|
|
|
endif
|
|
|
|
|
else
|
|
|
|
|
return "\<CR>"
|
|
|
|
|
endif
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
" <CR> close popup and save indent or expand snippet
|
|
|
|
|
imap <expr> <CR> CleverCr()
|
2013-08-29 00:11:58 +00:00
|
|
|
|
|
2013-10-18 04:09:59 +00:00
|
|
|
|
" <CR>: close popup
|
|
|
|
|
" <s-CR>: close popup and save indent.
|
|
|
|
|
inoremap <expr><s-CR> pumvisible() ? neocomplcache#close_popup()"\<CR>" : "\<CR>"
|
2014-03-31 20:24:39 +00:00
|
|
|
|
"inoremap <expr><CR> pumvisible() ? neocomplcache#close_popup() : "\<CR>"
|
2013-08-29 00:11:58 +00:00
|
|
|
|
|
2013-10-18 04:09:59 +00:00
|
|
|
|
" <C-h>, <BS>: close popup and delete backword char.
|
|
|
|
|
inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
|
|
|
|
|
inoremap <expr><C-y> neocomplcache#close_popup()
|
2013-08-29 00:11:58 +00:00
|
|
|
|
endif
|
|
|
|
|
" <TAB>: completion.
|
|
|
|
|
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
|
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<TAB>"
|
|
|
|
|
" }
|
2013-06-06 08:20:19 +00:00
|
|
|
|
|
|
|
|
|
" Enable omni completion.
|
|
|
|
|
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
|
|
|
|
|
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
|
|
|
|
|
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
|
|
|
|
|
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
|
|
|
|
|
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
|
|
|
|
|
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
|
2013-06-21 11:21:43 +00:00
|
|
|
|
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
|
2013-06-06 08:20:19 +00:00
|
|
|
|
|
|
|
|
|
" Enable heavy omni completion.
|
|
|
|
|
if !exists('g:neocomplcache_omni_patterns')
|
|
|
|
|
let g:neocomplcache_omni_patterns = {}
|
|
|
|
|
endif
|
|
|
|
|
let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
|
|
|
|
|
let g:neocomplcache_omni_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
|
|
|
|
|
let g:neocomplcache_omni_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
|
|
|
|
|
let g:neocomplcache_omni_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
|
|
|
|
|
let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\h\w*\|\h\w*::'
|
2014-05-03 17:54:30 +00:00
|
|
|
|
let g:neocomplcache_omni_patterns.go = '\h\w*\.\?'
|
2013-11-30 01:45:24 +00:00
|
|
|
|
" }
|
|
|
|
|
" Normal Vim omni-completion {
|
2014-01-27 10:17:56 +00:00
|
|
|
|
" To disable omni complete, add the following to your .vimrc.before.local file:
|
|
|
|
|
" let g:spf13_no_omni_complete = 1
|
|
|
|
|
elseif !exists('g:spf13_no_omni_complete')
|
2013-11-30 01:45:24 +00:00
|
|
|
|
" Enable omni-completion.
|
|
|
|
|
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
|
|
|
|
|
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
|
|
|
|
|
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
|
|
|
|
|
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
|
|
|
|
|
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
|
|
|
|
|
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
|
|
|
|
|
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
|
|
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
" }
|
|
|
|
|
|
|
|
|
|
" Snippets {
|
|
|
|
|
if count(g:spf13_bundle_groups, 'neocomplcache') ||
|
|
|
|
|
\ count(g:spf13_bundle_groups, 'neocomplete')
|
2013-06-06 08:20:19 +00:00
|
|
|
|
|
|
|
|
|
" Use honza's snippets.
|
|
|
|
|
let g:neosnippet#snippets_directory='~/.vim/bundle/vim-snippets/snippets'
|
|
|
|
|
|
|
|
|
|
" Enable neosnippet snipmate compatibility mode
|
|
|
|
|
let g:neosnippet#enable_snipmate_compatibility = 1
|
|
|
|
|
|
|
|
|
|
" For snippet_complete marker.
|
2013-12-01 01:48:02 +00:00
|
|
|
|
if !exists("g:spf13_no_conceal")
|
|
|
|
|
if has('conceal')
|
|
|
|
|
set conceallevel=2 concealcursor=i
|
|
|
|
|
endif
|
2013-06-06 08:20:19 +00:00
|
|
|
|
endif
|
|
|
|
|
|
2014-04-02 13:19:41 +00:00
|
|
|
|
" Enable neosnippets when using go
|
|
|
|
|
let g:go_snippet_engine = "neosnippet"
|
|
|
|
|
|
2013-06-06 08:20:19 +00:00
|
|
|
|
" Disable the neosnippet preview candidate window
|
|
|
|
|
" When enabled, there can be too much visual noise
|
|
|
|
|
" especially when splits are used.
|
|
|
|
|
set completeopt-=preview
|
2012-11-26 19:15:58 +00:00
|
|
|
|
endif
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" }
|
2012-01-09 20:04:38 +00:00
|
|
|
|
|
2013-11-30 01:45:24 +00:00
|
|
|
|
" FIXME: Isn't this for Syntastic to handle?
|
|
|
|
|
" Haskell post write lint and check with ghcmod
|
|
|
|
|
" $ `cabal install ghcmod` if missing and ensure
|
|
|
|
|
" ~/.cabal/bin is in your $PATH.
|
|
|
|
|
if !executable("ghcmod")
|
|
|
|
|
autocmd BufWritePost *.hs GhcModCheckAndLintAsync
|
|
|
|
|
endif
|
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" UndoTree {
|
2012-10-07 02:35:54 +00:00
|
|
|
|
nnoremap <Leader>u :UndotreeToggle<CR>
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" If undotree is opened, it is likely one wants to interact with it.
|
|
|
|
|
let g:undotree_SetFocusWhenToggle=1
|
|
|
|
|
" }
|
2012-01-28 06:22:33 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" indent_guides {
|
2012-10-06 05:19:44 +00:00
|
|
|
|
let g:indent_guides_start_level = 2
|
|
|
|
|
let g:indent_guides_guide_size = 1
|
|
|
|
|
let g:indent_guides_enable_on_vim_startup = 1
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" }
|
2012-10-06 05:19:44 +00:00
|
|
|
|
|
2013-09-01 23:39:14 +00:00
|
|
|
|
" vim-airline {
|
|
|
|
|
" Set configuration options for the statusline plugin vim-airline.
|
|
|
|
|
" Use the powerline theme and optionally enable powerline symbols.
|
|
|
|
|
" To use the symbols , , , , , , and .in the statusline
|
|
|
|
|
" segments add the following to your .vimrc.before.local file:
|
|
|
|
|
" let g:airline_powerline_fonts=1
|
|
|
|
|
" If the previous symbols do not render for you then install a
|
|
|
|
|
" powerline enabled font.
|
2013-12-01 04:17:44 +00:00
|
|
|
|
|
|
|
|
|
" See `:echo g:airline_theme_map` for some more choices
|
|
|
|
|
" Default in terminal vim is 'dark'
|
|
|
|
|
if !exists('g:airline_theme')
|
|
|
|
|
let g:airline_theme = 'solarized'
|
2013-12-01 01:58:08 +00:00
|
|
|
|
endif
|
2013-09-02 19:48:33 +00:00
|
|
|
|
if !exists('g:airline_powerline_fonts')
|
2013-09-01 23:39:14 +00:00
|
|
|
|
" Use the default set of separators with a few customizations
|
|
|
|
|
let g:airline_left_sep='›' " Slightly fancier than '>'
|
|
|
|
|
let g:airline_right_sep='‹' " Slightly fancier than '<'
|
2013-09-02 19:48:33 +00:00
|
|
|
|
endif
|
2013-03-29 03:12:26 +00:00
|
|
|
|
" }
|
|
|
|
|
|
2010-04-20 16:08:48 +00:00
|
|
|
|
" }
|
|
|
|
|
|
|
|
|
|
" GUI Settings {
|
2013-01-05 07:59:43 +00:00
|
|
|
|
|
2011-12-10 20:10:06 +00:00
|
|
|
|
" GVIM- (here instead of .gvimrc)
|
|
|
|
|
if has('gui_running')
|
2013-01-05 07:59:43 +00:00
|
|
|
|
set guioptions-=T " Remove the toolbar
|
2013-01-26 17:53:46 +00:00
|
|
|
|
set lines=40 " 40 lines of text instead of 24
|
2013-12-01 04:19:48 +00:00
|
|
|
|
if !exists("g:spf13_no_big_font")
|
|
|
|
|
if LINUX() && has("gui_running")
|
2014-06-30 16:34:21 +00:00
|
|
|
|
set guifont=Andale\ Mono\ Regular\ 12,Menlo\ Regular\ 11,Consolas\ Regular\ 12,Courier\ New\ Regular\ 14
|
2013-12-01 04:19:48 +00:00
|
|
|
|
elseif OSX() && has("gui_running")
|
2014-06-30 16:34:21 +00:00
|
|
|
|
set guifont=Andale\ Mono\ Regular:h12,Menlo\ Regular:h11,Consolas\ Regular:h12,Courier\ New\ Regular:h14
|
2013-12-01 04:19:48 +00:00
|
|
|
|
elseif WINDOWS() && has("gui_running")
|
|
|
|
|
set guifont=Andale_Mono:h10,Menlo:h10,Consolas:h10,Courier_New:h10
|
|
|
|
|
endif
|
2012-07-06 13:17:00 +00:00
|
|
|
|
endif
|
2011-12-10 20:10:06 +00:00
|
|
|
|
else
|
2012-07-07 19:57:39 +00:00
|
|
|
|
if &term == 'xterm' || &term == 'screen'
|
2013-01-26 17:53:46 +00:00
|
|
|
|
set t_Co=256 " Enable 256 colors to stop the CSApprox warning and make xterm vim shine
|
2012-07-07 19:57:39 +00:00
|
|
|
|
endif
|
2012-02-08 03:11:37 +00:00
|
|
|
|
"set term=builtin_ansi " Make arrow and other keys work
|
2011-12-10 20:10:06 +00:00
|
|
|
|
endif
|
2013-01-05 07:59:43 +00:00
|
|
|
|
|
2010-04-20 16:08:48 +00:00
|
|
|
|
" }
|
2010-08-20 16:26:46 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" Functions {
|
2011-05-20 12:36:38 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" Initialize directories {
|
|
|
|
|
function! InitializeDirectories()
|
|
|
|
|
let parent = $HOME
|
|
|
|
|
let prefix = 'vim'
|
|
|
|
|
let dir_list = {
|
|
|
|
|
\ 'backup': 'backupdir',
|
|
|
|
|
\ 'views': 'viewdir',
|
|
|
|
|
\ 'swap': 'directory' }
|
2012-02-15 20:19:28 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
if has('persistent_undo')
|
|
|
|
|
let dir_list['undo'] = 'undodir'
|
|
|
|
|
endif
|
2012-02-15 20:19:28 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" To specify a different directory in which to place the vimbackup,
|
|
|
|
|
" vimviews, vimundo, and vimswap files/directories, add the following to
|
2013-08-28 23:34:19 +00:00
|
|
|
|
" your .vimrc.before.local file:
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" let g:spf13_consolidated_directory = <full path to desired directory>
|
|
|
|
|
" eg: let g:spf13_consolidated_directory = $HOME . '/.vim/'
|
|
|
|
|
if exists('g:spf13_consolidated_directory')
|
|
|
|
|
let common_dir = g:spf13_consolidated_directory . prefix
|
|
|
|
|
else
|
|
|
|
|
let common_dir = parent . '/.' . prefix
|
|
|
|
|
endif
|
2013-01-03 20:27:12 +00:00
|
|
|
|
|
2013-01-05 07:59:43 +00:00
|
|
|
|
for [dirname, settingname] in items(dir_list)
|
|
|
|
|
let directory = common_dir . dirname . '/'
|
|
|
|
|
if exists("*mkdir")
|
|
|
|
|
if !isdirectory(directory)
|
|
|
|
|
call mkdir(directory)
|
|
|
|
|
endif
|
|
|
|
|
endif
|
2012-02-15 20:19:28 +00:00
|
|
|
|
if !isdirectory(directory)
|
2013-01-05 07:59:43 +00:00
|
|
|
|
echo "Warning: Unable to create backup directory: " . directory
|
|
|
|
|
echo "Try: mkdir -p " . directory
|
|
|
|
|
else
|
|
|
|
|
let directory = substitute(directory, " ", "\\\\ ", "g")
|
|
|
|
|
exec "set " . settingname . "=" . directory
|
2012-02-15 20:19:28 +00:00
|
|
|
|
endif
|
2013-01-05 07:59:43 +00:00
|
|
|
|
endfor
|
|
|
|
|
endfunction
|
2013-08-28 23:34:19 +00:00
|
|
|
|
call InitializeDirectories()
|
2013-01-05 07:59:43 +00:00
|
|
|
|
" }
|
|
|
|
|
|
|
|
|
|
" Initialize NERDTree as needed {
|
|
|
|
|
function! NERDTreeInitAsNeeded()
|
|
|
|
|
redir => bufoutput
|
|
|
|
|
buffers!
|
|
|
|
|
redir END
|
|
|
|
|
let idx = stridx(bufoutput, "NERD_tree")
|
|
|
|
|
if idx > -1
|
|
|
|
|
NERDTreeMirror
|
|
|
|
|
NERDTreeFind
|
|
|
|
|
wincmd l
|
2012-02-15 20:19:28 +00:00
|
|
|
|
endif
|
2013-01-05 07:59:43 +00:00
|
|
|
|
endfunction
|
|
|
|
|
" }
|
|
|
|
|
|
|
|
|
|
" Strip whitespace {
|
|
|
|
|
function! StripTrailingWhitespace()
|
2013-10-12 20:03:17 +00:00
|
|
|
|
" Preparation: save last search, and cursor position.
|
|
|
|
|
let _s=@/
|
|
|
|
|
let l = line(".")
|
|
|
|
|
let c = col(".")
|
|
|
|
|
" do the business:
|
|
|
|
|
%s/\s\+$//e
|
|
|
|
|
" clean up: restore previous search history, and cursor position
|
|
|
|
|
let @/=_s
|
|
|
|
|
call cursor(l, c)
|
2013-01-05 07:59:43 +00:00
|
|
|
|
endfunction
|
|
|
|
|
" }
|
2012-11-23 03:05:20 +00:00
|
|
|
|
|
2013-03-29 03:12:26 +00:00
|
|
|
|
" Shell command {
|
|
|
|
|
function! s:RunShellCommand(cmdline)
|
|
|
|
|
botright new
|
|
|
|
|
|
|
|
|
|
setlocal buftype=nofile
|
|
|
|
|
setlocal bufhidden=delete
|
|
|
|
|
setlocal nobuflisted
|
|
|
|
|
setlocal noswapfile
|
|
|
|
|
setlocal nowrap
|
|
|
|
|
setlocal filetype=shell
|
|
|
|
|
setlocal syntax=shell
|
|
|
|
|
|
|
|
|
|
call setline(1, a:cmdline)
|
|
|
|
|
call setline(2, substitute(a:cmdline, '.', '=', 'g'))
|
|
|
|
|
execute 'silent $read !' . escape(a:cmdline, '%#')
|
|
|
|
|
setlocal nomodifiable
|
|
|
|
|
1
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
command! -complete=file -nargs=+ Shell call s:RunShellCommand(<q-args>)
|
|
|
|
|
" e.g. Grep current file for <search_term>: Shell grep -Hn <search_term> %
|
|
|
|
|
" }
|
|
|
|
|
|
2011-05-20 12:36:38 +00:00
|
|
|
|
" }
|
2010-08-31 20:41:34 +00:00
|
|
|
|
|
2012-09-27 04:46:17 +00:00
|
|
|
|
" Use fork vimrc if available {
|
|
|
|
|
if filereadable(expand("~/.vimrc.fork"))
|
2012-09-27 06:12:35 +00:00
|
|
|
|
source ~/.vimrc.fork
|
2012-09-27 04:46:17 +00:00
|
|
|
|
endif
|
|
|
|
|
" }
|
2012-11-26 19:15:58 +00:00
|
|
|
|
|
2010-08-31 20:41:34 +00:00
|
|
|
|
" Use local vimrc if available {
|
|
|
|
|
if filereadable(expand("~/.vimrc.local"))
|
|
|
|
|
source ~/.vimrc.local
|
|
|
|
|
endif
|
|
|
|
|
" }
|
2011-06-16 15:48:24 +00:00
|
|
|
|
|
|
|
|
|
" Use local gvimrc if available and gui is running {
|
2012-04-18 09:06:30 +00:00
|
|
|
|
if has('gui_running')
|
|
|
|
|
if filereadable(expand("~/.gvimrc.local"))
|
2011-06-16 15:48:24 +00:00
|
|
|
|
source ~/.gvimrc.local
|
|
|
|
|
endif
|
|
|
|
|
endif
|
2011-06-20 14:25:17 +00:00
|
|
|
|
" }
|