call pathogen#infect()
""""""""""""""""""""""""""""""""""""
" Set shell config on windows
""""""""""""""""""""""""""""""""""""
if executable('sh.exe')
set shell=sh.exe\ -login
set shellcmdflag=-c
set shellquote="
endif
""""""""""""""""""""""""""""""""""""
" General plugin configurations
""""""""""""""""""""""""""""""""""""
"""" Syntastic """"
" Disable error display on cursor move
let g:syntastic_echo_current_error = 0
"""" NeoComplCache """"
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use smartcase.
let g:neocomplcache_enable_smart_case = 1
" Use camel case completion.
let g:neocomplcache_enable_camel_case_completion = 1
" Use underbar completion.
let g:neocomplcache_enable_underbar_completion = 1
" Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
" 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['default'] = '\h\w*'
" Plugin key-mappings.
" imap <C-k> <Plug>(neocomplcache_snippets_expand)
" smap <C-k> <Plug>(neocomplcache_snippets_expand)
inoremap <expr><C-g> neocomplcache#undo_completion()
inoremap <expr><C-l> neocomplcache#complete_common_string()
" Enable code folding for Vimwiki
let g:vimwiki_folding = 1
" SuperTab like snippets behavior.
"imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>"
" Recommended key-mappings.
inoremap <expr><CR> pumvisible() ? neocomplcache#close_popup() : "\<CR>"
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <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()
" AutoComplPop like behavior.
let g:neocomplcache_enable_auto_select = 1
" 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 php setlocal omnifunc=phpcomplete#CompletePHP
" 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.c = '\%(\.\|->\)\h\w*'
let g:neocomplcache_omni_patterns.cpp = '\h\w*\%(\.\|->\)\h\w*\|\h\w*::'
"""" NERDTree """"
"Let NERDTree decide cwd (top of current tree)
let g:NERDTreeChDirMode=2
"Map F8 to NERDTreeToggle
map <F8> :NERDTreeToggle<cr>
"""" Tagbar """"
"Map F7 to tagbar
nmap <F7> :TagbarToggle<cr>
let g:tagbar_autoclose=1
let g:tagbar_left=1
"""" CtrlP """"
let g:ctrlp_custom_ignore = 'node_modules'
""""""""""""""""""""""""""""""""""""
" General setup
""""""""""""""""""""""""""""""""""""
"only javascript indent one level for multiple brackets on same line (jQuery)
let g:SimpleJsIndenter_BriefMode = 1
"Syntax highlight sql queries
let g:php_sql_query=1
"Syntax highlight html in strings
let g:php_htmlInStrings=1
"Auto generate folds by indent
set foldmethod=indent
"But dont show them by default
set foldlevel=20
syntax on
filetype plugin indent on
"Fix indents
set tabstop=2
set softtabstop=2
set shiftwidth=2
set relativenumber
"Allow backspace to do its thing
set backspace=indent,eol,start
"Expand tabs to spaces
set expandtab
"Take a guess
set enc=utf-8
"Windows specific configuration
if has('win32') || has('win64')
"Set font
set gfn=Consolas:h12
let g:ruby_path="c:\Ruby193\bin"
endif
"Change default folder for ~ and .swp files
if( expand($TEMP) == "" )
"Default for linux
let s:tempFolder = "/tmp"
else
"Default for windows
let s:tempFolder = expand($TEMP)
endif
let &directory=s:tempFolder
let &backupdir=s:tempFolder
"Ignore case on searches, unless search contains uppercase
set ignorecase smartcase
set completeopt=longest,menuone
"Highlight searchresults
set hlsearch
"Display suggestions for commands
set wildmenu wildmode=list:full
set incsearch
"Hide files from plugins
set wildignore=*/.git/*
"Compile .as files using enter
autocmd BufNewFile,BufRead *.as nnoremap <buffer> <CR> !mxmlc %<CR>
autocmd BufNewFile,BufRead *.as set filetype=actionscript
"Set colorscheme
set background=dark
colorscheme solarized
"return the syntax highlight group under the cursor ''
function! StatuslineCurrentHighlight()
let name = synIDattr(synID(line('.'),col('.'),1),'name')
if name == ''
return ''
else
return '[' . name . ']'
endif
endfunction
"recalculate the tab warning flag when loading and after writing
autocmd BufReadPost,bufwritepost * unlet! b:statusline_tab_warning
"return '[&et]' if &et is set wrong
"return '[mixed-indenting]' if spaces and tabs are used to indent
"return an empty string if everything is fine
function! StatuslineTabWarning()
if !exists("b:statusline_tab_warning")
let b:statusline_tab_warning = ''
if !&modifiable
return b:statusline_tab_warning
endif
let tabs = search('^\t', 'nw') != 0
"find spaces that arent used as alignment in the first indent column
let spaces = search('^ \{' . &ts . ',}[^\t]', 'nw') != 0
if tabs && spaces
let b:statusline_tab_warning = '[mixed-indenting]'
elseif (spaces && !&et) || (tabs && &et)
let b:statusline_tab_warning = ' [&et]'
endif
endif
return b:statusline_tab_warning
endfunction
"statusline setup
set statusline=%f "tail of the filename
set statusline+=\
"display a warning if fileformat isnt unix
set statusline+=%#warningmsg#
set statusline+=%{&ff!='unix'?'['.&ff.']':''}
set statusline+=%*
"display a warning if file encoding isnt utf-8
set statusline+=%{(&fenc!='')?'['.&fenc.']':''}
set statusline+=%h "help file flag
set statusline+=%y "filetype
set statusline+=%r "read only flag
set statusline+=%m "modified flag
"display a warning if &et is wrong, or we have mixed-indenting
set statusline+=%#error#
set statusline+=%{StatuslineTabWarning()}
set statusline+=%*
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
set statusline+=%= "left/right separator
function! SlSpace()
if exists("*GetSpaceMovement")
return "[" . GetSpaceMovement() . "]"
else
return ""
endif
endfunc
set statusline+=%{SlSpace()}
set statusline+=%{StatuslineCurrentHighlight()}\ \ "current highlight
set statusline+=%c, "cursor column
set statusline+=%l/%L "cursor line/total lines
set statusline+=\ %P "percent through file
set laststatus=2
"Remap gd to go to definition
nnoremap gd <C-]>
inoremap kj <ESC>
"Insert current time with F5
inoremap <F5> <C-R>=strftime("%H:%M:%S")<CR>
nnoremap - :Switch<cr>
let g:detectindent_prefered_indent = 2
let g:detectindent_preferred_expandtab = 1
autocmd BufReadPost * :DetectIndent
"Set visual bell
set vb
au BufCreate ~/vimwiki/index.wiki silent !cd ~/vimwiki/; git pull origin master
au BufWritePost ~/vimwiki/* silent !start sh -c "cd ~/vimwiki/; git add .; git commit -a -m ' - '"
au BufWritePost ~/vimwiki/* silent !cd ~/vimwiki/;git push origin master