Skip to content

Instantly share code, notes, and snippets.

@nddrylliog
Last active December 11, 2015 11:19
Show Gist options
  • Save nddrylliog/4592994 to your computer and use it in GitHub Desktop.
Save nddrylliog/4592994 to your computer and use it in GitHub Desktop.
My .vimrc - uses vundle to manage packages, tailored to ooc usage mostly
colorscheme jellybeans
" tab navigation like firefox
nnoremap <C-S-tab> :tabprevious<CR>
nnoremap <C-tab> :tabnext<CR>
nnoremap <C-t> :tabnew<CR>
inoremap <C-S-tab> <Esc>:tabprevious<CR>i
inoremap <C-tab> <Esc>:tabnext<CR>i
inoremap <C-t> <Esc>:tabnew<CR>
nmap tv "+gP
imap tv <ESC><C-V>i
vmap tc "+y
set guioptions=ea
set guifont=Consolas\ 12
set lines=60
set columns=212
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" My Bundles here:
" Refer to |:NeoBundle-examples|.
" Support code
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'tools\\update-dll-mingw',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'unix' : 'make -f make_unix.mak',
\ },
\ }
" Languages
NeoBundle 'nddrylliog/ooc.vim'
NeoBundle 'kchmck/vim-coffee-script'
NeoBundle 'leafo/moonscript-vim'
NeoBundle 'slim-template/vim-slim'
NeoBundle 'tikhomirov/vim-glsl'
" Utils
" NeoBundle 'ervandew/supertab'
NeoBundle 'Shougo/neocomplete.vim'
NeoBundle 'camelcasemotion'
NeoBundle 'bling/vim-airline'
NeoBundle 'tpope/vim-surround'
NeoBundle 'tpope/vim-unimpaired'
NeoBundle 'tpope/vim-commentary'
NeoBundle 'tpope/vim-abolish'
NeoBundle 'tpope/vim-repeat'
NeoBundle 'scrooloose/syntastic'
" Version control
NeoBundle 'tpope/vim-fugitive'
"Too slow!
" NeoBundle 'airblade/vim-gitgutter'
" Themes
NeoBundle 'nanotech/jellybeans.vim'
" Navigation
NeoBundle 'scrooloose/nerdtree.git'
NeoBundle 'Shougo/unite.vim'
call neobundle#end()
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
"""""""""""""""""""""""""""""""""""""""""""""""
" NeoComplete settings
"""""""""""""""""""""""""""""""""""""""""""""""
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
" Define dictionary.
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" Define keyword.
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
" inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
" function! s:my_cr_function()
" return neocomplete#close_popup() . "\<CR>"
" " For no inserting <CR> key.
" " return pumvisible() ? neocomplete#close_popup() : "\<CR>"
" endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><C-y> neocomplete#close_popup()
inoremap <expr><C-e> neocomplete#cancel_popup()
" Close popup by <Space>.
"inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>"
" For cursor moving in insert mode(Not recommended)
"inoremap <expr><Left> neocomplete#close_popup() . "\<Left>"
"inoremap <expr><Right> neocomplete#close_popup() . "\<Right>"
"inoremap <expr><Up> neocomplete#close_popup() . "\<Up>"
"inoremap <expr><Down> neocomplete#close_popup() . "\<Down>"
" Or set this.
"let g:neocomplete#enable_cursor_hold_i = 1
" Or set this.
"let g:neocomplete#enable_insert_char_pre = 1
" AutoComplPop like behavior.
"let g:neocomplete#enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplete#enable_auto_select = 1
"let g:neocomplete#disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
" 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
" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\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*::'
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
" Unite commands
let g:unite_data_directory='~/.vim/.cache/unite'
let g:unite_source_file_rec_max_cache_files = 0
let g:unite_source_history_yank_enable = 1
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
let g:unite_enable_start_insert=1
let g:unite_prompt='» '
let g:unite_split_rule = 'botright'
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts =
\ '-i --line-numbers --nocolor --nogroup --hidden --ignore ' .
\ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'''
let g:unite_source_grep_recursive_opt = ''
let g:unite_source_rec_async_command= 'ag --follow --nocolor --nogroup --hidden --ignore ' .
\ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'' -g ""'
nnoremap <silent> <C-p> :Unite -no-split file_rec/async<cr>
nnoremap <space>/ :Unite grep:.<CR>
nnoremap <space>y :Unite history/yank<cr>
nnoremap <space>s :Unite -quick-match buffer<cr>
autocmd FileType unite call s:unite_my_settings()
function! s:unite_my_settings()"{{{
" Overwrite settings.
imap <buffer> jj <Plug>(unite_insert_leave)
"imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
imap <buffer><expr> j unite#smart_map('j', '')
imap <buffer> <TAB> <Plug>(unite_select_next_line)
imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
imap <buffer> ' <Plug>(unite_quick_match_default_action)
nmap <buffer> ' <Plug>(unite_quick_match_default_action)
imap <buffer><expr> x
\ unite#smart_map('x', "\<Plug>(unite_quick_match_choose_action)")
nmap <buffer> x <Plug>(unite_quick_match_choose_action)
nmap <buffer> <C-z> <Plug>(unite_toggle_transpose_window)
imap <buffer> <C-z> <Plug>(unite_toggle_transpose_window)
imap <buffer> <C-y> <Plug>(unite_narrowing_path)
nmap <buffer> <C-y> <Plug>(unite_narrowing_path)
nmap <buffer> <C-j> <Plug>(unite_toggle_auto_preview)
nmap <buffer> <C-r> <Plug>(unite_narrowing_input_history)
imap <buffer> <C-r> <Plug>(unite_narrowing_input_history)
nnoremap <silent><buffer><expr> l
\ unite#smart_map('l', unite#do_action('default'))
let unite = unite#get_current_unite()
if unite.profile_name ==# 'search'
nnoremap <silent><buffer><expr> r unite#do_action('replace')
else
nnoremap <silent><buffer><expr> r unite#do_action('rename')
endif
nnoremap <silent><buffer><expr> cd unite#do_action('lcd')
nnoremap <buffer><expr> S unite#mappings#set_current_filters(
\ empty(unite#mappings#get_current_filters()) ?
\ ['sorter_reverse'] : [])
" Runs "split" action by <C-s>.
imap <silent><buffer><expr> <C-s> unite#do_action('split')
endfunction"}}}
let t_Co=256 " 256 colors aw yiss
filetype plugin indent on " required!
syntax on
set background=dark
colorscheme jellybeans
set backup
set backupdir=~/.vim/backup " where to put backup files
set directory=~/.vim/tmp " directory to place swap files in
set number " show line numbers
set numberwidth=5 " good until 10000
set ruler " show line/column
set scrolloff=5 " keep 5 lines of context around
set shortmess=aOstT " display short message to avoid ellipsis
set showcmd " show commands as you're typing it
set showmatch " jump to matches when entering regexp
set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]
set visualbell t_vb= " turn off error beep/flash
set novisualbell " turn off visual bell
set backspace=indent,eol,start " make backspace work the way it should
set smartindent
set completeopt="" " turn off completion popup
set expandtab " no real tabs please!
set ignorecase " case-insensitive search...
set infercase " ...except there are caps in the search expr
set smartcase " no ignorecase if Uppercase present
set shiftround " tab key aligns to the nearest tabulation
set shiftwidth=2 " 2-space wide shifts
set softtabstop=2 " 2-space wide soft tabs
set tabstop=8 " visible tabs
set is " incremental search
set hlsearch " highlight search result
set cursorline " highlight current line
" Tab navigation
nnoremap tq :q<CR>
nnoremap tw :tabclose<CR>
nnoremap th :tabfirst<CR>
nnoremap tj :tabnext<CR>
nnoremap tk :tabprev<CR>
nnoremap tl :tablast<CR>
nnoremap tn :tabnew<CR>
nnoremap tt :tabedit<Space>
nnoremap tm :tabm<Space>
nnoremap td :tabedit %<CR>:Gdiff<CR>
nnoremap tD :tabclose<CR>:tabprev<CR>
nnoremap ts :Gstatus<CR>
nnoremap tC :Gcommit<CR>
nnoremap ta :nohl<CR>
nnoremap t, :NERDTree ~/Dev/
nnoremap t. :NERDTree .<CR>
"nnoremap tr :!make run<CR>
nnoremap tr :!./lestac<CR>
let g:session_autosave = 0
let g:session_autoload = 0
let g:syntastic_auto_loc_list = 2
let g:syntastic_coffee_coffeelint_args="--csv -f /home/amos/.coffeelint.json"
nmap <F4> :make<CR>
nmap <F5> :!./lestac<CR>
nmap <F8> :SyntasticToggle<CR>
autocmd FileType moon set commentstring=--\ %s
" Only do this part when compiled with support for autocommands
if has("autocmd")
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exec "normal g'\"" |
\ endif
endif
au BufNewFile,BufRead *.md set filetype=markdown
au BufNewFile,BufRead *.template set filetype=html
au BufNewFile,BufRead *.ll set filetype=llvm
" auto-open NERDTree on vim start
" au VimEnter * NERDTree .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment