Last active
August 29, 2015 13:59
-
-
Save edi9999/10472072 to your computer and use it in GitHub Desktop.
.vimrc
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
execute pathogen#infect() | |
set nocompatible | |
let mapleader = "," | |
au BufReadCmd *.docx call zip#Browse(expand("<amatch>")) | |
" Sets how many lines of history VIM has to remember | |
set history=700 | |
" Enable filetype plugins | |
filetype plugin on | |
filetype indent on | |
" Set to auto read when a file is changed from the outside | |
set autoread | |
" Set 7 lines to the cursor - when moving vertically using j/k | |
set so=7 | |
" Turn on the WiLd menu | |
set wildmenu | |
" Ignore compiled files | |
set wildignore=*.o,*~,*.pyc | |
if has("win16") || has("win32") | |
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store | |
else | |
set wildignore+=.git\*,.hg\*,.svn\* | |
endif | |
"Clipboard with p | |
:set clipboard+=unnamed | |
"Always show current position | |
set noruler | |
" Height of the command bar | |
set cmdheight=1 | |
" A buffer becomes hidden when it is abandoned | |
set hid | |
syntax on | |
"""""""for code"""""""""" | |
"colorscheme moria | |
"colorscheme two2tango | |
colorscheme freya | |
"colorscheme github | |
"""""""for text""""""" | |
"colorscheme earendel | |
"automatic coffeelinting options | |
let g:syntastic_coffee_coffeelint_args = "--csv --file ~/.vim/bundle/coffeelint.json" | |
"Write the old file out when switching between files | |
set autowrite | |
set timeoutlen=500 | |
set tabstop=3 | |
set shiftwidth=3 | |
set guifont= | |
set nonumber | |
" Configure backspace so it acts as it should act | |
set backspace=eol,start,indent | |
set whichwrap+=<,>,h,l | |
" Ignore case when searching | |
set ignorecase | |
"highlight search results | |
set hlsearch | |
set clipboard=unnamed | |
"Incremental search, shows as you type | |
set incsearch | |
" Don't redraw while executing macros (good performance config) | |
set lazyredraw | |
" For regular expressions turn magic on | |
set magic | |
" Show matching brackets when text indicator is over them | |
set showmatch | |
" How many tenths of a second to blink when matching brackets | |
set mat=8 | |
" No annoying sound on errors | |
set noerrorbells | |
set novisualbell | |
set t_vb= | |
set tm=500 | |
" Add a bit extra margin to the left | |
set foldcolumn=1 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Files, backups and undo | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Turn backup off, since most stuff is in SVN, git et.c anyway... | |
set nobackup | |
set nowb | |
set noswapfile | |
" Linebreak on 500 characters | |
set lbr | |
set tw=500 | |
set wrap "Wrap lines | |
"""""""""""""""""""""""""""""" | |
" => Visual mode related | |
"""""""""""""""""""""""""""""" | |
" Visual mode pressing * or # searches for the current selection | |
" Super useful! From an idea by Michael Naumann | |
vnoremap <silent> * :call VisualSelection('f', '')<CR> | |
vnoremap <silent> # :call VisualSelection('b', '')<CR> | |
"toggle line numbers with leader 1 | |
map <leader>1 :set number!<cr> | |
" Useful mappings for managing tabs | |
map <leader>c :tabclose<cr> | |
" Specify the behavior when switching between buffers | |
try | |
set switchbuf=useopen,usetab,newtab | |
set stal=2 | |
catch | |
endtry | |
" Return to last edit position when opening files (You want this!) | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line("'\"") <= line("$") | | |
\ exe "normal! g`\"" | | |
\ endif | |
" Remember info about open buffers on close | |
set viminfo^=% | |
"""""""""""""""""""""""""""""" | |
" => Status line | |
"""""""""""""""""""""""""""""" | |
" Always show the status line | |
set laststatus=2 | |
" Returns true if paste mode is enabled | |
function! HasPaste() | |
if &paste | |
return 'PASTE MODE ' | |
en | |
return '' | |
endfunction | |
" Map auto complete of (, ", ', [ | |
inoremap ( ()<esc>i | |
inoremap [ []<esc>i | |
inoremap { {}<esc>i | |
inoremap ' ''<esc>i | |
inoremap " ""<esc>i | |
inoremap < <><esc>i | |
" Format the status line | |
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Editing mappings | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Remap VIM 0 to first non-blank character | |
map 0 ^ | |
" Move a line of text using ALT+[jk] | |
nmap <M-j> mz:m+<cr>`z | |
nmap <M-k> mz:m-2<cr>`z | |
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z | |
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z | |
" Delete trailing white space on save, useful for Python and CoffeeScript ;) | |
func! DeleteTrailingWS() | |
exe "normal mz" | |
%s/\s\+$//ge | |
exe "normal `z" | |
endfunc | |
autocmd BufWrite *.py :call DeleteTrailingWS() | |
autocmd BufWrite *.coffee :call DeleteTrailingWS() | |
autocmd BufWrite *.php :call DeleteTrailingWS() | |
autocmd BufWrite *.vimrc :call DeleteTrailingWS() | |
set guioptions-=m "remove menu bar | |
set guioptions-=T "remove toolbar | |
set guioptions-=r "remove right-hand scroll bar | |
set linespace=12 | |
set encoding=utf-8 | |
set noexpandtab | |
set copyindent | |
set preserveindent | |
set softtabstop=0 | |
set shiftwidth=4 | |
set tabstop=4 | |
nnoremap j gj | |
nnoremap k gk | |
imap jj <esc> | |
set ignorecase | |
set vb t_vb= | |
set noerrorbells "no beep | |
nnoremap <silent> n n:call HLNext(0.4)<cr> | |
nnoremap <silent> N N:call HLNext(0.4)<cr> | |
highlight matchAfter ctermbg=red guibg=red | |
call matchadd('matchAfter','\%81v',100) | |
highlight superSearch ctermbg=blue guibg=blue | |
" OR ELSE just highlight the match in red... | |
function! HLNext (blinktime) | |
let [bufnum, lnum, col, off] = getpos('.') | |
let matchlen = strlen(matchstr(strpart(getline('.'),col-1),@/)) | |
let target_pat = '\c\%#'.@/ | |
let ring = matchadd('superSearch', target_pat, 101) | |
redraw | |
exec 'sleep ' . float2nr(a:blinktime * 1000) . 'm' | |
call matchdelete(ring) | |
redraw | |
endfunction | |
"Show tabs and trailing spaces specially | |
set listchars= | |
set listchars=tab:>-,trail:~,extends:>,precedes:< | |
""exec "set listchars=tab:\uB0\uB0" | |
autocmd BufRead *.coffee :exec "set listchars=tab:\uB4\uBB,trail:\uB7,nbsp:0" | |
autocmd BufRead *.py :exec "set listchars=tab:\uB4\uBB,trail:\uB7,nbsp:0" | |
set list | |
"go to directory of current file | |
nmap <Leader>d :e %:h<cr> | |
"Duplicate current file into tab | |
nmap <Leader><Leader> :tabedit %<cr> | |
nmap <Leader>xc :cd /home/edgar/www/docxtemplater/coffee<cr>:e.<cr> | |
nmap <Leader>xt :cd /home/edgar/www/docxtemplater/coffee<cr>:e docxgenTest.coffee<cr> | |
nmap <Leader>x :cd /home/edgar/www/docxtemplater<cr>:e.<cr> | |
nmap <Leader>xr :cd /home/edgar/www/docxtemplater<cr>:e readme.md<cr> | |
nmap <Leader>xe :cd /home/edgar/www/docxtemplater/examples<cr>:e.<cr> | |
nmap <Leader>xd :cd /home/edgar/www/docxtemplater/examples/<cr>:e demo.html<cr> | |
nmap <Leader>xx :cd /home/edgar/www/docxtemplater<cr>:e.<cr> | |
nmap <Leader>xj :cd /home/edgar/www/docxtemplater/js<cr>:e.<cr> | |
"load pokertell project | |
nmap <Leader>p :cd /home/edgar/www/phjs<cr>:e.<cr> | |
nmap <Leader>pt :cd /home/edgar/www/phjs/public/jasmine/<cr>:e.<cr> | |
nmap <Leader>pp :cd /home/edgar/www/phjs/public<cr>:e.<cr> | |
nmap <Leader>pc :cd /home/edgar/www/phjs/coffee<cr>:e.<cr> | |
nmap <Leader>ps :e /home/edgar/www/phjs/stylus<cr> | |
nmap <Leader>pl :e /home/edgar/www/phjs/public/lib<cr> | |
nmap <Leader>pj :e /home/edgar/www/phjs/public/js<cr> | |
nmap <Leader>r :cd /home/edgar/www/noorassur/<cr>:e.<cr> | |
nmap <Leader>rd :cd /home/edgar/www/noorassur/sous-domaines/dev<cr>:e.<cr> | |
nmap <Leader>rl :cd /home/edgar/www/noorassur/sous-domaines/visio<cr>:e.<cr> | |
nmap <Leader>rv :cd /home/edgar/www/noorassur/sous-domaines/visio/app/views<cr>:e.<cr> | |
nmap <Leader>rp :cd /home/edgar/www/noorassur/sous-domaines/visio/public<cr>:e.<cr> | |
nmap <Leader>ra :cd /home/edgar/www/noorassur/sous-domaines/visio/app<cr>:e.<cr> | |
nmap <Leader>rc :cd /home/edgar/www/noorassur/sous-domaines/visio/app/controllers<cr>:e.<cr> | |
nmap <Leader>rm :cd /home/edgar/www/noorassur/sous-domaines/visio/app/models<cr>:e.<cr> | |
nmap <Leader>rr :cd /home/edgar/www/noorassur/sous-domaines/visio/app/<cr>:e routes.php<cr> | |
"load brokenclassroom | |
nmap <Leader>b :e /home/edgar/www/brokenclassroom/<cr> | |
nmap <Leader>br :e /home/edgar/www/brokenclassroom/Readme.md<cr> | |
nmap <Leader>ft :cd /home/edgar/www/frbit-sdk/tests/Frbit/Tests/Sdk<cr>:e.<cr> | |
"t automatically tests the files | |
nmap <Leader>tt :! cd /home/edgar/www/piquick/laravel/ && phpunit<cr> | |
nmap <Leader>sy :cd <cr>:e.<cr> | |
nmap <Leader>gc :e ~/.gitconfig<cr> | |
nmap <Leader>gu :e ~<cr> | |
",l automatically shows laravel folder | |
nmap <Leader>ll :cd /home/edgar/www/piquick/laravel/app/storage/logs<cr>:e.<cr> | |
nmap <Leader>lib :cd /home/edgar/www/piquick/laravel/app/library<cr>:e.<cr> | |
nmap <Leader>l :cd /home/edgar/www/piquick/laravel<cr>:e.<cr> | |
nmap <Leader>la :cd /home/edgar/www/piquick/laravel/app<cr>:e.<cr> | |
nmap <Leader>ltes :cd /home/edgar/www/piquick/laravel/app/tests<cr>:e.<cr> | |
nmap <Leader>ltem :cd /home/edgar/www/piquick/laravel/public/templates<cr>:e.<cr> | |
nmap <Leader>lpu :cd /home/edgar/www/piquick/laravel/public<cr>:e.<cr> | |
nmap <Leader>ljs :cd /home/edgar/www/piquick/laravel/public/js<cr>:e.<cr> | |
nmap <Leader>lve :cd /home/edgar/www/piquick/laravel/public/vendor<cr>:e.<cr> | |
nmap <Leader>lvi :cd /home/edgar/www/piquick/laravel/app/views<cr>:e.<cr> | |
nmap <Leader>lfi :e /home/edgar/www/piquick/laravel/app/filters.php<cr> | |
nmap <Leader>lco :cd /home/edgar/www/piquick/laravel/app/controllers<cr>:e.<cr> | |
nmap <Leader>lcm :cd /home/edgar/www/piquick/laravel/app/commands<cr>:e.<cr> | |
nmap <Leader>lcf :cd /home/edgar/www/piquick/laravel/app/config<cr>:e.<cr> | |
nmap <Leader>lcfp :cd /home/edgar/www/piquick/laravel/app/config/production<cr>:e.<cr> | |
nmap <Leader>lmo :cd /home/edgar/www/piquick/laravel/app/models<cr>:e.<cr> | |
nmap <Leader>lst :e /home/edgar/www/piquick/laravel/app/stylus/etude.styl<cr> | |
nmap <Leader>lmi :cd /home/edgar/www/piquick/laravel/app/database/migrations<cr>:e.<cr> | |
nmap <Leader>lse :cd /home/edgar/www/piquick/laravel/app/database/seeds<cr>:e.<cr> | |
nmap <Leader>lr :e /home/edgar/www/piquick/laravel/app/routes.php<cr> | |
nmap <Leader>lil :e /home/edgar/www/piquick/laravel/vendor/laravel/framework/src/Illuminate<cr> | |
",f automatically shows laravel folder | |
nmap <Leader>fl :cd /home/edgar/www/fortrabbit/app/storage/logs<cr>:e.<cr> | |
nmap <Leader>fib :cd /home/edgar/www/fortrabbit/app/library<cr>:e.<cr> | |
nmap <Leader>f :cd /home/edgar/www/fortrabbit<cr>:e.<cr> | |
nmap <Leader>fa :cd /home/edgar/www/fortrabbit/app<cr>:e.<cr> | |
nmap <Leader>ftes :cd /home/edgar/www/fortrabbit/app/tests<cr>:e.<cr> | |
nmap <Leader>ftem :cd /home/edgar/www/fortrabbit/public/templates<cr>:e.<cr> | |
nmap <Leader>fpu :cd /home/edgar/www/fortrabbit/public<cr>:e.<cr> | |
nmap <Leader>fjs :cd /home/edgar/www/fortrabbit/public/js<cr>:e.<cr> | |
nmap <Leader>fve :cd /home/edgar/www/fortrabbit/public/vendor<cr>:e.<cr> | |
nmap <Leader>fvi :cd /home/edgar/www/fortrabbit/app/views<cr>:e.<cr> | |
nmap <Leader>ffi :e /home/edgar/www/fortrabbit/app/filters.php<cr> | |
nmap <Leader>fco :cd /home/edgar/www/fortrabbit/app/controllers<cr>:e.<cr> | |
nmap <Leader>fcm :cd /home/edgar/www/fortrabbit/app/commands<cr>:e.<cr> | |
nmap <Leader>fcf :cd /home/edgar/www/fortrabbit/app/config<cr>:e.<cr> | |
nmap <Leader>fcfp :cd /home/edgar/www/fortrabbit/app/config/production<cr>:e.<cr> | |
nmap <Leader>fmo :cd /home/edgar/www/fortrabbit/app/models<cr>:e.<cr> | |
nmap <Leader>fst :e /home/edgar/www/fortrabbit/app/stylus/etude.styl<cr> | |
nmap <Leader>fmi :cd /home/edgar/www/fortrabbit/app/database/migrations<cr>:e.<cr> | |
nmap <Leader>fse :cd /home/edgar/www/fortrabbit/app/database/seeds<cr>:e.<cr> | |
nmap <Leader>fr :e /home/edgar/www/fortrabbit/app/routes.php<cr> | |
nmap <Leader>fil :e /home/edgar/www/fortrabbit/vendor/laravel/framework/src/Illuminate<cr> | |
nmap <Leader>w :cd /home/edgar/www/<cr>:e.<cr> | |
"Save with Ctrl+S | |
imap <C-S> <Esc>:w<cr>a | |
nmap <C-S> :w<cr> | |
"nerd tree toggling faster | |
nmap <Leader>nt :NERDTreeToggle<cr> | |
set completeopt=longest,menuone | |
"Edit vimrc | |
nmap <Leader>ev :e $MYVIMRC<cr> | |
nmap <Leader>sni :e ~/vimfiles/snippets<cr> | |
"Source vimrc | |
nmap <Leader>sv :source $MYVIMRC<cr> | |
"remove find results | |
command! H let @/="" | |
highlight Search cterm=underline | |
set nobackup "no backup files | |
set nowritebackup " only in case you don't want a backup file while editing | |
set noswapfile | |
set wildmode=list:longest | |
set foldenable | |
set mousehide | |
nmap <space> : | |
fun! ReloadSnippets( snippets_dir, ft ) | |
if strlen( a:ft ) == 0 | |
let filetype = "_" | |
else | |
let filetype = a:ft | |
endif | |
call ResetSnippets() | |
call GetSnippets( a:snippets_dir, filetype ) | |
endfun | |
nmap <Leader>ss :call ReloadSnippets("~/vimfiles/snippets","php.laravel")<cr> | |
autocmd FileType php set ft=php.laravel | |
"cd to directory of current file | |
autocmd BufEnter * cd %:p:h | |
autocmd! BufWritePost .vimrc source % |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment