Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " Map Leader key
- let mapleader= ","
- " Set always commands as VIM mode, not VI mode.
- set nocompatible
- " Pathogen plugins
- execute pathogen#infect()
- call pathogen#helptags()
- " Syntax highlighting
- syntax on
- filetype indent on
- filetype on
- filetype plugin on
- set modelines=0
- " Enable syntax colors
- syntax enable
- " Solarized scheme color preferences
- let g:solarized_termcolors=256
- let g:solarized_termtrans = 1
- let g:solarized_bold = 1
- let g:solarized_underline = 1
- let g:solarized_italic = 1
- let g:solarized_contrast = "normal"
- let g:solarized_visibility= "high"
- colorscheme solarized
- " Background color from color scheme
- " set background=light
- set background=dark
- " Show selected line with background
- set cursorline
- :hi CursorLine cterm=NONE ctermbg=0 guibg=darkblue ctermfg=NONE ctermfg=NONE
- :hi Visual cterm=NONE ctermbg=0 ctermfg=NONE
- " Incremental search: each time I type a letter, vim will perfom a search
- set incsearch
- " Make searches insensite case
- set ignorecase
- " Highlight results
- set hlsearch
- nnoremap <leader><Space> :noh<CR>
- " If use capital case, search will be case sensitive, if use normal case,
- " search will be insensive case.
- set smartcase
- " Auto-indentation
- set autoindent
- " Set indentation to 2 espaces
- set softtabstop=2
- set shiftwidth=2
- " Convert tabs to spaces
- set expandtab
- " Autoindent in cmd mode
- set smartindent
- " Auto indent in PHP and HTML files
- au BufRead *.php set ft=php.html
- au BufNewFile *.php set ft=php.html
- au BufRead *.htm set ft=php.html
- au BufNewFile *.htm set ft=php.html
- au BufRead *.html set ft=php.html
- au BufNewFile *.html set ft=php.html
- """"""""""""""""""""""""" TIM POPE """"""""""""""""""""""""""
- " Delete comment character when joining commented lines
- if v:version > 703 || v:version == 703 || v:version > 800 && has("patch541")
- set formatoptions+=j
- endif
- set autoread
- set fileformats+=mac
- " set formatoptions-=cro
- " Deactivate auto commenting in second line
- " Check :help fo-table in help
- autocmd BufNewFile,BufRead * setlocal formatoptions-=cro
- set showcmd
- set wildmenu
- set hidden
- set ttyfast
- set complete-=i
- set smarttab
- " Search
- nnoremap / /\v
- vnoremap / /\v
- nnoremap <leader>s /\v
- set gdefault
- " Use 'tab' key to go to parethesis inmediately
- nnoremap <tab> %
- vnoremap <tab> %
- set wrap
- " Max width
- set textwidth=79
- " set formatoptions=qrn1
- " Scroll speed
- if !&scrolloff
- set scrolloff=1
- endif
- if !&sidescrolloff
- set sidescrolloff=5
- endif
- set display+=lastline
- if &shell =~# 'fish$'
- set shell=/bin/bash
- endif
- " Allow color schemes to do bright colors without forcing bold.
- if &t_Co == 8 && $TERM !~# '^linux\|^Eterm'
- set t_Co=16
- endif
- set nrformats-=octal
- set ttimeout
- set ttimeoutlen=100
- " Set rows number from 1 to 9
- set relativenumber
- " Create a undofile to recover things
- set undofile
- " Disable arrow keys
- nnoremap <up> <nop>
- nnoremap <down> <nop>
- nnoremap <left> <nop>
- nnoremap <right> <nop>
- inoremap <up> <nop>
- inoremap <down> <nop>
- inoremap <left> <nop>
- inoremap <right> <nop>
- inoremap <BS> <nop>
- inoremap <del> <nop>
- nnoremap j gj
- nnoremap k gk
- " Save on losing focus
- au FocusLost * :wa
- " Ack Plugin
- nnoremap <leader>a :Ack "
- """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
- " Set Line numbers
- set number
- " Always display row/column info in bottom
- " set ruler
- " Use UTF-8 as the default text encoding
- set encoding=utf-8
- set fileencoding=utf-8
- " start: allows to erase furtheR from the starting point
- " eol: allows to continue deleting from one line to another up (joining lines)
- " indent: allows to delete indents
- set backspace=indent,eol,start
- " Allows to use delete key to join lines
- set ts=2 sts=2 sw=2 expandtab
- " Coloring matching braces (), []. {}, etc...
- set showmatch
- " Show all tabs, stops, etc
- set nolist
- " set list
- " set listchars=tab:▸\ ,eol:¬,nbsp:⋅,trail:•
- " set listchars=tab:▸\ ,eol:¬,nbsp:⋅,trail:•
- " Set vim font
- set guifont=PragmataPro
- if &listchars ==# 'eol:$'
- set listchars=tab:▸\ ,trail:•,eol:¬,extends:>,precedes:<,nbsp:+
- endif
- " if &listchars ==# 'eol:$'
- " set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
- " endif
- " No create swap backup files
- set noswapfile
- " Only alert flashin the screen
- set visualbell
- " Set guide color column
- set cc=80
- " hi ColorColumn ctermbg=darkgray guibg=darkgray
- " Folding method
- set fdm=manual
- :hi Folded cterm=NONE ctermbg=0 guibg=NONE ctermfg=NONE
- " :hi CursorLine cterm=NONE ctermbg=0 guibg=darkblue ctermfg=NONE ctermfg=NONE
- " :hi Visual cterm=NONE ctermbg=0 ctermfg=NONE
- " Keep folds automatically
- augroup remember_folds
- autocmd!
- autocmd BufWinLeave *.* mkview
- autocmd BufWinEnter *.* loadview
- augroup END
- "############## Insert mode mappings ############
- " Complete sentece/word/code and select fordwards from completition menu
- inoremap <leader><Tab> <C-n>
- " Select backwards from completition menu
- " inoremap <S-Tab> <C-p>
- " CTRL + d = Delete
- inoremap <C-d> <Del>
- " CTRL + h = Backspace
- inoremap <C-h> <BS>
- " Arrow moves
- inoremap <C-p> <Up>
- inoremap <C-n> <Down>
- inoremap <C-b> <Left>
- inoremap <C-f> <Right>
- " Move to beginging/end of the line
- inoremap <C-e> <C-o><S-$>
- inoremap <C-a> <C-o><S-^>
- " Insert a new line above
- inoremap <C-k> <Up><C-o><S-$><CR>
- " Insert a new line bellow
- inoremap <C-j> <C-o><S-$><CR>
- " Quickly escape
- inoremap jj <ESC>
- "############## Normal mode mapping ##############"
- " Save and source at once
- nnoremap <leader>w <Esc>:w<CR><Esc>:so %<CR>
- " Same as type ":" colon to type a command in vim
- nnoremap <Space> <Esc>:
- " Close panels/tabs
- nnoremap <leader>q <Esc>:q<CR>
- " Set paste mode
- nnoremap <leader>, <Esc>:set paste!<CR>
- " Copy 'Yank selected text'
- nnoremap <leader>y "*y
- " PBCOPY
- vnoremap <leader>y :!pbcopy<CR>u
- " PBPASTE
- nnoremap <leader>p :read !pbpaste<CR>
- " Sort lines ascendently
- vnoremap <leader>s :!sort<CR>
- " Open vimrc in a vertical split window
- nnoremap <leader>ev <C-w><C-v><C-l>:e $MYVIMRC<cr>
- " Reselect text that previously paste
- nnoremap <leader>v V`]
- " Move between panel windows
- nnoremap <C-h> <C-w>h
- nnoremap <C-j> <C-w>j
- nnoremap <C-k> <C-w>k
- nnoremap <C-l> <C-w>l
- " Move lines up/down
- nnoremap <leader>2 :m .+1<CR>==
- nnoremap <leader>1 :m .-2<CR>==
- inoremap <leader>2 <Esc>:m .+1<CR>==gi
- inoremap <leader>1 <Esc>:m .-2<CR>==gi
- vnoremap <leader>2 :m '>+1<CR>gv=gv
- vnoremap <leader>1 :m '<-2<CR>gv=gv
- " JS and PHP CONSOLE (builds) in split window
- command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>)
- function! s:RunShellCommand(cmdline)
- let isfirst = 1
- let words = []
- for word in split(a:cmdline)
- if isfirst
- let isfirst = 0 " don't change first word (shell command)
- else
- if word[0] =~ '\v[%#<'
- let word = expand(word)
- endif
- let word = shellescape(word, 1)
- endif
- call add(words, word)
- endfor
- let expanded_cmdline = join(words)
- botright new
- setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
- call setline(1, 'You entered: ' . a:cmdline)
- call setline(2, 'Expanded to: ' . expanded_cmdline)
- call append(line('$'), substitute(getline(2), '.', '=', 'g'))
- silent execute '$read !'. expanded_cmdline
- 1
- endfunction
- " Command to run JS console with RunJS
- command! -complete=file -nargs=* NodeJS call s:RunShellCommand('node '.<q-args>)
- " Command to run PHP console with PHPBuild
- command! -complete=file -nargs=* PHPBuild call s:RunShellCommand('php '.<q-args>)
- " Keyboard Shorcut for NodeJS % in split window
- nnoremap <leader>j <Esc>:w<CR><Esc>:NodeJS %<CR>
- " Keyboard Shorcut for NodeJS % in split window
- " nnoremap <leader>p <Esc>:w<CR><Esc>:PHPBuild %<CR>
- " Node % in shell
- nmap <leader>n <ESC>:!node
- "############### Plugins ###############"
- " HTML5 Syntax Hi
- let g:html5_event_handler_attributes_complete = 1
- let g:html5_rdfa_attributes_complete = 1
- let g:html5_microdata_attributes_complete = 1
- let g:html5_aria_attributes_complete = 1
- " Syntastic populate location list with errors
- let g:syntastic_always_populate_loc_list = 1
- " Syntastic will open/close location list automatically
- " 0 Not auto
- " 1 Automatic
- " 2 Not open auto, but closes auto
- let g:syntastic_auto_loc_list = 0
- " Syntastic location list height
- let g:syntastic_loc_list_height = 4
- " Syntastic check on open
- let g:syntastic_check_on_open = 1
- " Syntastic check whenever buffers are wirtten to disk
- let g:syntastic_check_on_wq = 1
- " Syntastic enable all checkers that apply to the current filetype
- " including style checkers
- let g:syntastic_aggregate_errors = 1
- let g:syntastic_id_checkers = 1
- " Syntastic error symbols
- let g:syntastic_error_symbol = "✗"
- let g:syntastic_warning_symbol = "⚠"
- " Syntastic preferences for statusline
- set statusline+=%#warningmsg#
- set statusline+=%{SyntasticStatuslineFlag()}
- set statusline+=%*
- let g:syntastic_javascript_checkers = ['eslint']
- let g:syntastic_html_checkers = ['jshint']
- let g:syntastic_css_checkers = ['csslint']
- let g:syntastic_php_checkers = ['PHPLint', 'php']
- " Syntastic Javascript allowed checkers
- let g:syntastic_javascript_jshint_exec = '/Users/Stevens/.nvm/versions/node/v6.3.1/bin/jshint' " Syntax checker
- let g:syntastic_css_csslint_exec = '/Users/Stevens/.nvm/versions/node/v6.3.1/bin/csslint'
- " Path /usr/local/Cellar/tidy-html5/4.9.35
- let g:syntastic_html_tidy_exec = 'tidy5'
- " TernJS
- let g:tern_show_signature_in_pum = 1
- " Enable keyboard shorcuts
- let g:tern_map_keys= 1
- " Automatic hints after a dealy
- let g:tern_show_argument_hints = "on_hold"
- " Emmet Zen Coding
- " Emmet only active in HTML and CSS
- let g:user_emmet_install_global = 0
- autocmd FileType html,css EmmetInstall
- " Emmet Expand key
- let g:user_emmet_leader_key="<Tab>"
- let g:use_emmet_complete_tag = 0
- " Emmet activated in insert mode only. Options n, i, v, a.
- let g:user_emmet_mode='i'
- " TComment
- " Make single line comment or comment selected lines
- map <leader>c <c-_><c-_>
- " Lightline
- set laststatus=2
- set noshowmode
- let g:lightline = {
- \ 'colorscheme': 'solarized',
- \ 'active': {
- \ 'left': [ [ 'mode', 'paste' ],
- \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
- \ },
- \ 'component_function': {
- \ 'gitbranch': 'fugitive#head'
- \ },
- \ }
- " NerdTree Sidebar Explorer
- " Autoload if there is no file specified
- autocmd StdinReadPre * let s:std_in=1
- autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
- " NerdTree open sidebar
- map <leader>m :NERDTreeToggle<CR>
- " NerdTree closes if is the only one window
- autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
- " Show hidden files
- let NERDTreeShowHidden=1
- " Tabularize
- " if exists(":Tabularize")
- " nmap <leader>a= :Tabularize /=<CR>
- " vmap <leader>a= :'<,'>Tabularize /=<CR>
- " nmap <leader>a: :Tabularize /:<CR>
- " vmap <leader>a: :'<,'>Tabularize /:<CR>
- " " nmap <leader>a: :Tabularize /:\zs<CR>
- " " vmap <leader>a: :'<,'>Tabularize /:\zs<CR>
- " endif
- " Tabular
- inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
- " Tabular align in realtime when using "|"
- function! s:align()
- let p = '^\s*|\s.*\s|\s*$'
- if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
- let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
- let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
- Tabularize/|/l1
- normal! 0
- call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
- endif
- endfunction
- " YouCompleteMe and UltiSnips compatibility, with the helper of supertab
- let g:ycm_key_list_select_completion = ['<A-¶>', '<A-Space>', '<Down>']
- let g:ycm_key_list_previous_completion = ['<A-§>', '<A-π>', '<Up>']
- " Plugin 'ervandew/supertab'
- let g:SuperTabDefaultCompletionType = '<A-Space>'
- let g:SuperTabCrMapping = 0
- " Plugin 'SirVer/ultisnips'
- let g:UltiSnipsExpandTrigger="<tab>"
- let g:UltiSnipsJumpForwardTrigger="<tab>"
- let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
- let g:snips_author="Stevens Garcia"
- let g:snips_author_email="smalmsteeng@gmail.com"
- let g:UltiSnipsSnippetDirectories=["UltiSnips", "/bundle/vim-snippets"]
- " let g:UltiSnipsSnippetDirectories=["UltiSnips"]
- let g:UltiSnipsEnableSnipMate = 1
- let g:UltiSnipsEditSplit = "vertical"
- " UltiSnips load javascript snippets order
- autocmd FileType javascript UltiSnipsAddFiletypes javascript.javascript-node.javascript-jsdoc.javascript-angular
- " You Complete Me Options
- let g:ycm_show_diagnostics_ui = 0
- let g:ycm_enable_diagnostic_highlighting = 0
- let g:ycm_enable_diagnostic_signs = 0
- let g:ycm_show_diagnostics_ui = 0
- let g:ycm_open_loclist_on_ycm_diags = 0
- let g:ycm_complete_in_comments = 0
- let g:ycm_complete_in_strings = 0
- let g:ycm_collect_identifiers_from_comments_and_strings = 0
- let g:ycm_collect_identifiers_from_tags_files = 1
- " let g:ycm_autoclose_preview_window_after_completion = 0
- " let g:ycm_autoclose_preview_window_after_insertion = 0
- " Autotag
- let g:autotagTagsFile=".tags"
Add Comment
Please, Sign In to add comment