Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " Prelude------------------------------------------------------------------{{{
- scriptencoding 'utf-8'
- filetype plugin indent on
- filetype plugin on
- filetype off
- " NEOBUNDLE-------------------------------------------------------------{{{
- if has('vim_starting')
- set runtimepath+=~/.vim/bundle/neobundle.vim/
- endif
- call neobundle#rc(expand('~/.vim/bundle/'))
- " Shougo
- NeoBundleFetch 'Shougo/neobundle.vim'
- NeoBundle 'Shougo/unite.vim.git'
- NeoBundle 'Shougo/neosnippet.vim.git'
- NeoBundle 'Shougo/vimproc'
- NeoBundle 'Shougo/neocomplcache.vim.git'
- " tpope
- NeoBundle 'tpope/vim-fugitive'
- NeoBundle 'tpope/vim-surround.git'
- " Srcrooloose
- NeoBundle 'scrooloose/nerdtree.git'
- NeoBundle 'scrooloose/syntastic.git'
- NeoBundle 'scrooloose/nerdcommenter.git'
- " Misc
- NeoBundle 'ervandew/supertab.git'
- NeoBundle 'gregsexton/gitv.git'
- NeoBundle 'Lokaltog/vim-easymotion'
- NeoBundle 'rstacruz/sparkup', {'rtp': 'vim/'}
- NeoBundle 'dhazel/conque-term'
- NeoBundle 'vim-scripts/dbext.vim'
- NeoBundle 'sjl/gundo.vim.git'
- NeoBundle 'Yggdroot/indentLine.git'
- NeoBundle 'Glench/Vim-Jinja2-Syntax.git'
- NeoBundle 'vim-scripts/ruby-matchit.git'
- NeoBundle 'altercation/vim-colors-solarized.git'
- NeoBundle 'tsaleh/vim-matchit.git'
- NeoBundle 'honza/vim-snippets.git'
- NeoBundle 'altercation/vim-colors-solarized.git'
- NeoBundle 'tomasr/molokai.git'
- NeoBundle 'godlygeek/tabular.git'
- NeoBundle 'brookhong/DBGPavim'
- NeoBundle 'php.vim'
- " }}}
- let mapleader = "," " Leader key for some bindings
- imap kj <ESC>
- imap KJ <ESC>
- map K <nop>
- " Formatting--------------------------------------------------------------{{{
- ""set formatprg=par\ -w80
- set wrap " Long lines are wraped to the next line
- set tw=80 " Insert line break at column 80
- set cursorline " Highlight current line
- set nu " Enable left side numbers
- set encoding=utf-8 " Set encoding for vim to interpret
- set nrformats-=octal " set the increment/decrement (ctrl-a/ctrl-x)
- set formatoptions=qrn21jtca " See help
- set linebreak
- " Indentation-----------------------------------------------------------{{{
- set autowrite " Automatically write to file when changing windows/tabs
- set autoindent " On every line break keep indentation
- set smartindent " Indents when needed and skips when in comments
- set expandtab " Don't use tab char, instead isert spaces
- set softtabstop=2 " Number of spaces to insert on tab
- set smarttab " When BS is used on expanded tab deletes the full tab
- set ts=2 " Number of spaces inserted on each new tab
- set sw=2 " Number of spaces interpreted for tab
- set bs=2 " Allow backspacing over indent, eol and the start of an insert
- set shiftround " Rounds indent to multiple of shiftwidth previewsly setted
- "}}}
- "}}}
- set nocompatible " Disable force compatibility for old vim
- set incsearch " Instant search on char type
- set showcmd " Always show command line
- set history=1000 " Command history size
- set fileencoding=utf-8 " Set encoding to file
- set termencoding=utf-8 " Set encoding for shell
- set timeoutlen=300 " Waiting time between keys to discard key combination
- set shell=/bin/zsh\ --login " Quick command on shell instead of full Conque
- set cf " Enable error files and jump between errors
- set clipboard+=unnamed " Yanks go to system pastebin (middle click)
- set autoread " Reload file if modified out of vim
- " Monitor vimrc file and source it when modified
- autocmd! bufwritepost .vimrc source %
- " Save when losing focus
- au FocusLost * :silent! wall
- " Graphical options------------------------------------------------------{{{
- set ruler " Show current line number and char
- set guioptions+=cfg " gui off, don't fork gui on detatch and show disabled menu
- set guioptions-=T " Disable tool bar
- set guioptions-=m " Disable menu bar
- set guioptions-=F " Disable footer bar
- set guioptions+=LlRrb " Bug, this is needed to delete the scrollbars
- set guioptions-=LlRrb " Turn off gui toolbar and scroll bars and take footer
- set scrolloff=6 " When scrolling keep cursor 6 lines from top or bottom
- set sidescroll=1 " Minimal number of chars to scroll sideways
- set sidescrolloff=8 " Keep cursor 8 lines from vertical edge
- set synmaxcol=200 " Limit syntax coloring column to make vim faster
- set laststatus=2 " Shows the last status always
- set wildmenu " Enhanced command completion
- set wildmode=list:longest
- set wildignore+=.hg,.git,.svn " Version control
- set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files
- set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images
- set wildignore+=*.o,*.obj,*.exe,*.manifest " compiled object files
- set wildignore+=*.spl " compiled spelling word lists
- set wildignore+=*.sw? " Vim swap files
- set showmode " Show current mode
- set ttyfast " Redraws more often in terminal
- set lazyredraw " Redraws only when necesary and not in execution of macros
- set viewoptions=folds,options,cursor,unix,slash
- set diffopt+=iwhite,vertical " ignore white space diffs
- au VimResized * :wincmd = " Resize splits when rezising window
- "}}}
- " Custom mapings---------------------------------------------------------{{{
- " Diffoff
- nnoremap <leader>D :diffoff!<CR>
- " Toggle invisible caracters
- nnoremap <leader>l :set list!<CR>
- " Break line in two
- nmap Ñ i<CR><Esc>
- " Sort lines
- nnoremap <leader>s vip:!sort<CR>
- vnoremap <leader>s :!sort<CR>
- " When in insert mode hit <C-u> to upper case the word
- " you just typed when on the end of the word
- inoremap <C-u> <ESC>mzgUiw`za
- " Clean trailing space
- nnoremap <leader>w mz:%s/\s\+$//<CR>:let @/=''<CR>`z
- " Window navigation made easy
- :nmap <C-j> <C-w>j
- :nmap <C-k> <C-w>k
- :nmap <C-h> <C-w>h
- :nmap <C-l> <C-w>l
- " Toggle numbers on left margin
- :nnoremap <leader>n :setlocal number!<CR>
- " Toggle type of numbering (relative/absolute)
- :nnoremap <leader>N :setlocal relativenumber!<CR>
- " Man pages triggered with M instead of K
- :nnoremap <C-M> K
- " Get the file under the cursor in a vertical split
- :map fg :vertical wincmd f<CR>
- " Gundo
- nnoremap <F7> :GundoToggle<CR>
- " Drag lines ----------------------------------------------------------{{{
- " <m-j> and <m-k> to drag lines in any mode
- noremap <M-j> :m+<CR>
- noremap <M-k> :m-2<CR>
- inoremap <M-j> <Esc>:m+<CR>
- inoremap <M-k> <Esc>:m-2<CR>
- vnoremap <M-j> :m'>+<CR>gv
- vnoremap <M-k> :m-2<CR>gv
- "}}}
- "}}}
- " Custom commands--------------------------------------------------------{{{
- command! -nargs=1 Vb call VerticalSplitBuffer( <f-args> )
- command! W w
- command! Q q
- command! Qa qa
- command! Term ConqueTerm zsh
- " Function to mimic vertical split with buffer already opened
- function! VerticalSplitBuffer( buffer )
- execute "vert sb" a:buffer
- endfunction
- "}}}
- " Undo, backup and info files--------------------------------------------{{{
- "For undo between sessions and more
- set backupdir=$HOME/.vim/tmp/backup/
- set directory=$HOME/.vim/tmp/swap/
- set viewdir=$HOME/.vim/tmp/view/
- set undodir=$HOME/.vim/tmp/undo/
- set backup
- set noswapfile
- set undofile
- set viminfo='50,n$HOME/.vim/tmp/viminfo
- if !isdirectory(expand(&backupdir))
- call mkdir(expand(&backupdir), "p")
- endif
- if !isdirectory(expand(&directory))
- call mkdir(expand(&directory), "p")
- endif
- if !isdirectory(expand(&undodir))
- call mkdir(expand(&undodir), "p")
- endif
- if !isdirectory(expand(&viewdir))
- call mkdir(expand(&viewdir), "p")
- endif
- "}}}
- " Markings---------------------------------------------------------------{{{
- set fillchars=diff:⣿,vert:│ " Chars to use as diff filler and window divider
- set relativenumber " Show line number and other numbers are relative to this
- set showbreak=↪ " Show this char when line is wraped from the line before
- " List of chars used by format␣ "invisible" chars
- set listchars=tab:▸\ ,trail:·,eol:¬,extends:»,precedes:«,nbsp:+
- " If showing, hide trail and eol chars when in insert mode
- "augroup trailing
- "au!
- "au InsertEnter * :set listchars-=trail:␣,eol:¬
- "augroup END
- " Check if terminal supports colors or is gui running
- if &t_Co > 2 || has("gui_running")
- syntax enable " Syntax highlight always on
- set hlsearch " Highlight ocurrences in search query
- set ignorecase " Ignore case sensitive search
- set showmatch " Show matching parens when cursor on one
- set incsearch " Do instant search on key stroke
- set smartcase " If search query has Upper case, then is case sensitive
- " Clear highlighted search ocurrences
- noremap <silent> <leader><space> :noh<CR>:call clearmatches()<CR>
- " Keep search matches in the middle of the window.
- nnoremap n nzzzv
- nnoremap N Nzzzv
- endif
- " Check if gui is running
- " Helptags for pathogen
- "Helptags
- set colorcolumn=80 " highlight 1 column after max char line
- if has("gui_running")
- set background=dark
- colorscheme solarized
- " Enable spell check
- setlocal spell spelllang=es_mx
- else
- set t_Co=256
- "colorscheme molokai
- " If no gui running, use default theme
- colorscheme default
- endif
- "}}}
- " Auto-complete options--------------------------------------------------{{{
- set complete=.,w,b,u,t
- set completeopt=longest,menuone,preview
- "}}}
- "}}}
- " Plugins configs----------------------------------------------------------{{{
- " DBGPavim ----------------------------------------------------------------{{{
- let g:dbgPavimBreakAtEntry = 1
- let g:dbgPavimPort = 9009
- " }}}
- " NERD Tree--------------------------------------------------------------{{{
- " Vertical directory tree on a buffer for full file exploration
- noremap <F2> :NERDTreeToggle<cr>
- inoremap <F2> <esc>:NERDTreeToggle<cr>
- augroup ps_nerdtree
- au!
- au Filetype nerdtree setlocal nolist
- " au Filetype nerdtree nnoremap <buffer> K :q<cr>
- augroup END
- let NERDTreeHighlightCursorline = 1
- let NERDTreeIgnore = ['.vim$', '\~$', '.*\.pyc$', 'pip-log\.txt$', 'whoosh_index',
- \ 'xapian_index', '.*.pid', 'monitor.py', '.*-fixtures-.*.json',
- \ '.*\.o$', 'db.db', 'tags.bak', '.*\.pdf$', '.*\.mid$',
- \ '.*\.midi$']
- let NERDTreeMinimalUI = 1
- let NERDTreeDirArrows = 1
- let NERDChristmasTree = 1
- let NERDTreeChDirMode = 2
- let NERDTreeMapJumpFirstChild = 'gK'
- let NERDTreeQuitOnOpen = 1
- " }}}
- " Guide lines configs----------------------------------------------------{{{
- " Show guide lines for each indentation level
- let g:indent_guides_start_level=2
- let g:indent_guides_guide_size=1
- if has("gui_running")
- let g:indentLine_char='│'
- else
- let g:indentLine_char='|'
- endif
- "}}}
- " Minibufexpl configs----------------------------------------------------{{{
- " List of opened buffers and manipulation
- "let g:miniBufExplMapWindowNavVim=1
- "let g:miniBufExplMapWindowNavArrows=1
- "let g:miniBufExplMapCTabSwitchBufs=1
- "let g:miniBufExplMapSelTarget=1
- "let g:miniBufExplMaxSize = 1
- "let g:miniBufExplMinSize = 1
- "let g:miniBufExplSplitBelow = 0
- "map <Leader>b :MiniBufExplorer<CR>
- "map <Leader>c :CMiniBufExplorer<cr>
- "map <Leader>u :UMiniBufExplorer<cr>
- "map <Leader>t :TMiniBufExplorer<cr>
- "}}}
- " Syntastic -------------------------------------------------------------{{{
- let g:syntastic_enable_signs = 1
- let g:syntastic_check_on_open = 1
- let g:syntastic_disabled_filetypes = ['html', 'rst']
- let g:syntastic_stl_format = '[%E{%e Errors}%B{, }%W{%w Warnings}]'
- let g:syntastic_jsl_conf = '$HOME/.vim/jsl.conf'
- "}}}
- " Unite -----------------------------------------------------------------{{{
- nnoremap <leader>b :Unite buffer<cr>
- nnoremap <leader>f :Unite -start-insert file_rec<cr>
- nnoremap <leader>/ :Unite grep:.<cr>
- nnoremap <leader>s :Unite -quick-match buffer<cr>
- let g:unite_source_history_yank_enable = 1
- nnoremap <leader>y :Unite history/yank<cr>
- "}}}
- " Dbext -----------------------------------------------------------------{{{
- let g:dbext_default_profile_PRUEBAS='type=SQLSRV:user=master_codice:passwd=Pass12345:host=10.1.11.15:SQLSRV_bin=sqsh:SQLSRV_cmd_options=:extra=-Scodice_qa_pruebas -D codice_net'
- let g:dbext_default_profile_CALIDAD='type=SQLSRV:user=codice_qa:passwd=Master12345:host=10.1.11.110:SQLSRV_bin=sqsh:SQLSRV_cmd_options=:extra=-Scodice_qa -D codice_qa'
- let g:dbext_default_profile_CALIDAD_PRUEBAS='type=SQLSRV:user=codice_qa:passwd=Master12345:host=10.1.11.15:SQLSRV_bin=sqsh:SQLSRV_cmd_options=:extra=-Scodice_qa -D codice_qa'
- " }}}
- "}}}
- " Some configs (like the folds and Jumping tags) are copy/paste from
- " https://bitbucket.org/sjl/dotfiles/src/tip/vim/vimrc
- " Credit to Steve Losh
- " Folds -------------------------------------------------------------------{{{
- " Where should the folds start
- set foldlevelstart=0
- " Space to toggle folds.
- nnoremap <Space> za
- vnoremap <Space> za
- " Make zO recursively open whatever top level fold we're in, no matter where the
- " cursor happens to be.
- nnoremap zO zCzO
- " "Focus" the current line. Basically:
- "
- " 1. Close all folds.
- " 2. Open just the folds containing the current line.
- " 3. Move the line to a little bit (15 lines) above the center of the screen.
- " 4. Pulse the cursor line.
- "
- " This mapping wipes out the z mark, which I never use.
- "
- " I use :sus for the rare times I want to actually background Vim.
- nnoremap <c-z> mzzMzvzz15<c-e>`z:Pulse<cr>
- function! MyFoldText() " {{{
- let line = getline(v:foldstart)
- let nucolwidth = &fdc + &number * &numberwidth
- let windowwidth = winwidth(0) - nucolwidth - 3
- let foldedlinecount = v:foldend - v:foldstart
- " expand tabs into spaces
- let onetab = strpart(' ', 0, &tabstop)
- let line = substitute(line, '\t', onetab, 'g')
- let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount))
- let fillcharcount = windowwidth - len(line) - len(foldedlinecount)
- if has("gui_running")
- return line . '…' . repeat(" ",fillcharcount) . foldedlinecount . '…' . ' '
- else
- return line . '...' . repeat(" ",fillcharcount) . foldedlinecount . '...' . ' '
- endif
- endfunction " }}}
- set foldtext=MyFoldText()
- " Vim {{{
- " Set vim to enable folds if it finds fold syntax on the file
- augroup ft_vim
- au!
- au FileType vim setlocal foldmethod=marker
- au FileType help setlocal textwidth=78
- augroup END
- " }}}
- "}}}
- " Jumping to tags.---------------------------------------------------------{{{
- "
- " Basically, <c-]> jumps to tags (like normal) and <c-\> opens the tag in a new
- " split instead.
- "
- " Both of them will align the destination line to the upper middle part of the
- " screen. Both will pulse the cursor line so you can see where the hell you
- " are. <c-\> will also fold everything in the buffer and then unfold just
- " enough for you to see the destination line.
- "nnoremap <c-]> <c-]>mzzvzz15<c-e>`z:Pulse<cr>
- "nnoremap <c-\> <c-w>v<c-]>mzzMzvzz15<c-e>`z:Pulse<cr>
- "}}}
- " The following maping is here to avoid syntax misshapend, the maping uses
- " unbalanced curly braces which "confuses" the editor, so I save it for the
- " end, do not put anything below it if you use folds or rely on syntax
- " highlighting, it's a personal choice to use curly braces like so
- " maping to insert { and new line before the closing }
- imap {{{ {<CR><ESC>O
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement