Created
August 15, 2016 18:41
-
-
Save hankpillow/84282d14b9a2bedf9683a70898237140 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scriptencoding utf-8 | |
if has('vim_starting') | |
if &compatible | |
set nocompatible | |
endif | |
set runtimepath+=~/.vim/bundle/neobundle.vim/ | |
endif | |
function! StripTrailingWhitespace() | |
let _s=@/ | |
let l = line(".") | |
let c = col(".") | |
%s/\s\+$//e | |
let @/=_s | |
call cursor(l, c) | |
endfunction | |
function! DuplicateLine() | |
let l = line(".") | |
let c = col(".") | |
norm YP | |
call cursor(l+1,c) | |
endfunction | |
augroup reload_vimrc | |
autocmd! | |
autocmd BufWritePost $MYVIMRC nested source $MYVIMRC | |
let @/ = "" | |
augroup END | |
"=============================================================================== | |
"Set Set Set Set | |
"=============================================================================== | |
set lazyredraw | |
set ttyfast | |
if has("autocmd") | |
filetype on | |
endif | |
set clipboard=unnamed | |
set laststatus=2 "always | |
set hlsearch | |
set smartcase | |
set wildmenu | |
set wildmode=list:longest,full | |
set nobackup | |
set nowb | |
set noswapfile | |
set showmode | |
set nowrap | |
set tabstop=4 "Number of spaces that a <Tab> in the file counts for. | |
set shiftwidth=4 "Returns the effective value of 'shiftwidth'. This is the 'shiftwidth' value unless it is zero, in which case it is the 'tabstop' value. | |
set noexpandtab "dont expand tabs into spaces | |
set completeopt=menu,preview,longest | |
set relativenumber | |
set history=1000 | |
set hidden | |
set backspace=indent,eol,start | |
set showmatch "show matching brackets/parentethesis | |
set incsearch "find as you type | |
set ignorecase | |
set autoindent | |
set scrolloff=5 "keep the curtose 5 lines from window borders | |
set splitright "put vsplit to the right of current | |
set splitbelow "put split window bottom of the current | |
"----------------------------------------------------------------------------- | |
"THEME | |
"----------------------------------------------------------------------------- | |
"set t_Co=256 | |
colorscheme murphy | |
set background=dark | |
set nolist | |
set listchars=tab:▸\ ,eol:•,trail:— | |
set showbreak=↳ | |
set mouse=a "auto enable mouse usage | |
set mousehide "hide cursor while typing | |
set lines=40 | |
set colorcolumn=0 | |
set guifont=Source\ Code\ Pro\ Medium:h16,DejaVu\ Sans\ Mono:h16 | |
"------------------------------------------------------------------------------ | |
" Status line | |
"------------------------------------------------------------------------------ | |
set statusline= | |
set statusline+=\ %f | |
set statusline+=\ @%{bufnr('%')} "buffer number | |
set statusline+=\ [%{strlen(&ft)?&ft:'none'}] " file type | |
set statusline+=\ %r "modified readonly filetype | |
set statusline+=%= | |
set statusline+=%(line:\ %l\/%L,\ col:\ %c%V%) | |
set statusline+=\ %{strlen(&fenc)?&fenc:'none'}\ "file encoding | |
set statusline+=%{&ff} "file format | |
"changing bar color based on document's changes | |
function! CheckDocStatus() | |
if &mod == 1 | |
hi statusline guibg=Yellow guifg=Black | |
else | |
hi statusline guibg=#B2B2B2 guifg=Black | |
endif | |
endfunction | |
"------------------------------------------------------------------------------ | |
"Auto command | |
"------------------------------------------------------------------------------ | |
"status line autocmd | |
autocmd InsertEnter * hi statusline guibg=Green guifg=Black | |
autocmd InsertLeave * call CheckDocStatus() | |
autocmd FileType * autocmd BufWritePre <buffer> call CheckDocStatus() | |
autocmd FileType vim,javascript,sh,python,xml,yml,json,html autocmd BufWritePre <buffer> call StripTrailingWhitespace() | |
"good for riot templates | |
autocmd BufNewFile,BufRead *.tag set syntax=html | |
autocmd BufNewFile,BufRead *.tag set filetype=html | |
"nodejs ejs template files | |
autocmd BufRead,BufNewFile *.ejs set filetype=html | |
autocmd BufRead,BufNewFile *.ejs set syntax=html | |
"Vim-Jinja2 | |
autocmd BufNewFile,BufRead *.njk set filetype=jinja | |
autocmd BufNewFile,BufRead *.njk set syntax=jinja | |
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS | |
autocmd FileType html,markdown,tag,ejs 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 | |
"------------------------------------------------------------------------------ | |
" <leader> maps | |
"------------------------------------------------------------------------------ | |
"change explorer to file's directory | |
noremap <leader>cd :lcd %:p:h<cr> | |
"toggle word wrapping lines | |
noremap <leader>ww :set wrap!<cr> | |
"resize buffer equally" Status line | |
noremap <Leader>= <C-w>= | |
"split window vertically and loads the actual buffer | |
noremap <leader>bb :vert sb<cr> | |
"close current buffer without saving | |
noremap <leader>bd :bdelete<cr> | |
"split all buffers into tabs | |
noremap <leader>ta :tab sball<cr> | |
"open current buffer on tab | |
noremap <leader>tt :tabedit %<cr> | |
"create new empty tab | |
noremap <leader>tn :tabnew<cr> | |
"every replace starts with 'magic' flag | |
noremap <leader>r :%s/\V | |
"every search starts with 'magic' flag | |
nnoremap / /\V | |
"------------------------------------------------------------------------------ | |
"<C> control maps | |
"------------------------------------------------------------------------------ | |
noremap <silent><C-h> :set hlsearch!<cr> | |
"change to insert mode and create a linebreak on carret's position | |
noremap <C-CR> i<cr> | |
"duplucate current line | |
noremap <C-d> :call DuplicateLine()<cr> | |
"moving around | |
noremap <C-Left> :tabprev<cr> | |
noremap <C-Right> :tabnext<cr> | |
noremap <C-S-Left> :bnext<cr> | |
noremap <C-S-Right> :bprev<cr> | |
" auto complete | |
inoremap <C-Space> <C-x><C-o> | |
inoremap <C-Tab> <C-n> | |
"------------------------------------------------------------------------------ | |
" arrow/move/etc maps | |
"------------------------------------------------------------------------------ | |
"move as graphical way with arrow (good when wordwrapping) | |
inoremap <Up> <C-o>gk | |
inoremap <Down> <C-o>gj | |
nnoremap <Up> gk | |
nnoremap <Down> gj | |
"reload wim file and clear CtrlP caches | |
noremap <F5> :CtrlPClearCache<cr> | |
"------------------------------------------------------------------------------ | |
" plugins setup | |
"------------------------------------------------------------------------------ | |
call neobundle#begin(expand('~/.vim/bundle')) | |
NeoBundleFetch 'Shougo/neobundle.vim' | |
NeoBundle 'Glench/Vim-Jinja2-Syntax' | |
NeoBundle 'editorconfig/editorconfig-vim' | |
NeoBundle 'ctrlpvim/ctrlp.vim' | |
NeoBundle 'pangloss/vim-javascript' | |
NeoBundle 'tpope/vim-surround' | |
NeoBundle 'scrooloose/nerdtree' | |
NeoBundle 'nelstrom/vim-visual-star-search' | |
NeoBundle 'Shougo/vimproc.vim', { | |
\ 'build' : { | |
\ 'windows' : 'tools\\update-dll-mingw', | |
\ 'cygwin' : 'make -f make_cygwin.mak', | |
\ 'mac' : 'make', | |
\ 'linux' : 'make', | |
\ 'unix' : 'gmake', | |
\ }, | |
\ } | |
call neobundle#end() | |
syntax on | |
filetype plugin indent on | |
"NERDTree | |
"autocmd StdinReadPre * let s:std_in=1 | |
"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
map <leader>s :NERDTreeToggle<cr> | |
let g:netrw_liststyle=3 | |
"ctrlp | |
let g:ctrlp_map = '<leader>f' | |
let g:ctrlp_show_hidden = 1 | |
set wildignore+=node_modules,bower_components | |
map <leader>bu :CtrlPBuffer<cr> | |
let g:ctrlp_custom_ignore = { | |
\ 'dir': '\v[\/]\.(DS_Store|git|hg|svn|optimized|compiled|node_modules)$', | |
\ 'file': '\v\.(exe|so|swp|zip|dll|java|pyc|png|jpg|gif|pdf)$', | |
\ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment