Skip to content

Instantly share code, notes, and snippets.

@olexpono
Last active December 17, 2015 11:49
Show Gist options
  • Save olexpono/5604955 to your computer and use it in GitHub Desktop.
Save olexpono/5604955 to your computer and use it in GitHub Desktop.
Dotfiles [9/27/13]
color molokai
if has("gui_running")
set guioptions=egmt
endif
set scrolloff=2
set listchars=trail:·,extends:>,tab:▻\ ,precedes:<
hi SpecialKey guifg=#313131
hi ExtraWhitespace ctermbg=black ctermfg=darkmagenta guifg=tan guibg=black
" highlight OverEightyLength ctermbg=darkred ctermfg=white guibg=#ff4400
set colorcolumn=79
highlight ColorColumn ctermbg=darkred ctermfg=white guibg=#1d2626
" match OverEightyLength /\%>80v.\+/
" Test for stupidly long lines to Test for stupidly long lines to Test for stupidly long lines to
set noswapfile
set guifont=Ubuntu\ Mono:h16
au BufNewFile,BufRead *.block set filetype=html
au BufNewFile,BufRead *.page set filetype=html
au BufNewFile,BufRead *.list set filetype=html
au BufNewFile,BufRead *.item set filetype=html
au BufNewFile,BufRead *.ejs set filetype=html
au BufNewFile,BufRead *.js.ejs set filetype=javascript
au BufNewFile,BufRead .tmux.conf set filetype=tmux
autocmd FileType less setlocal shiftwidth=2 tabstop=2
autocmd FileType css setlocal shiftwidth=2 tabstop=2
function! TwoSpaceTabs()
setlocal shiftwidth=2 tabstop=2
endfunction
function! FourSpaceTabs()
setlocal shiftwidth=4 tabstop=4
endfunction
autocmd FileType python call FourSpaceTabs()
autocmd FileType javascript call FourSpaceTabs()
" autocmd FileType css, less call TwoSpaceTabs()
" au filetypedetect FileType python, javascript call FourSpaceTabs()
" SESSIONS
function! MkSession()
let b:sessiondir = getcwd()
exe "SaveSession " . b:sessiondir
endfunction
function! LdSession()
if argc() == 0
let b:sessiondir = getcwd()
exe "OpenSession! " . b:sessiondir
endif
endfunction
let g:session_autosave="yes"
let g:session_autoload="no"
autocmd VimLeave * NERDTreeClose
au VimLeave * :call MkSession()
au VimEnter * nested :call LdSession()
autocmd VimEnter * NERDTree
" KEYBINDINGS
:inoremap kj <esc>
:inoremap jk <esc>
:map K gkJ
:nmap ci< T>vt<c
:imap <C-e> <C-y>,
:imap <C-t> <return>top: 0;<return>right: 0;<return>bottom: 0;<return>left: 0;
:inoremap <C-x> <C-y>k
:nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
:map <C-]> :NERDTreeToggle<CR>
:nmap H 0|
filetype plugin on
" Disable tab-completion from commas
imap <C-%> <Plug>snipMateNextOrTrigger
function! CleverTab()
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*[,]$'
return " "
elseif strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
return "\<Tab>"
else
" Should trigger <Plug>snipMateNextOrTrigger
return "\<Tab>"
endif
endfunction
inoremap <Tab> <C-R>=CleverTab()<CR>
" Russn hakers
function! ChangeFileencoding()
let encodings = ['cp1251', 'koi8-u', 'cp866']
let prompt_encs = []
let index = 0
while index < len(encodings)
call add(prompt_encs, index.'. '.encodings[index])
let index = index + 1
endwhile
let choice = inputlist(prompt_encs)
if choice >= 0 && choice < len(encodings)
execute 'e ++enc='.encodings[choice].' %:p'
endif
endf
nmap <F8> :call ChangeFileencoding()<CR>
" Control-P ignores node_modules
set wildignore+=*/node_modules/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment