Skip to content

Instantly share code, notes, and snippets.

@ggsalas
Last active March 1, 2017 00:45
Show Gist options
  • Save ggsalas/b3433166a3873b6fd5e54c3145b24f44 to your computer and use it in GitHub Desktop.
Save ggsalas/b3433166a3873b6fd5e54c3145b24f44 to your computer and use it in GitHub Desktop.
My vimrc configuration
"" first install with:
"" [x] git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
"" then, in vim do: :PluginInstall
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'scrooloose/nerdtree'
Plugin 'flazz/vim-colorschemes'
Plugin 'kien/ctrlp.vim'
Plugin 'tomtom/tcomment_vim'
Plugin 'tpope/vim-surround'
Plugin 'gabrielelana/vim-markdown'
Plugin 'godlygeek/tabular' " tables format, and more.
Plugin 'lukhio/vim-mapping-conflicts' " :CheckMapping
Plugin 'mattn/gist-vim'
Plugin 'mattn/webapi-vim' " to work with gist
Plugin 'mileszs/ack.vim' " [x] needs install ack: $ brew install ack
Plugin 'szw/vim-tags' " [x] needs install ctags: $ brew install ctags
Plugin 'vim-syntastic/syntastic' " config on bottom of this file
Plugin 'mtscout6/syntastic-local-eslint.vim' " allow syntastiv use the eslint config of the project
Plugin 'Valloric/YouCompleteMe' " YouCompleteMe needs execute:
" [x] brew install CMake
" [x] ~/.vim/bundle/YouCompleteMe/install.shlugin 'pangloss/vim-javascript'
call vundle#end() " required
filetype plugin indent on " required
"" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
"" :PluginSearch foo - searches for foo; append `!` to refresh local cache
"" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
""
"" see :h vundle for more details or wiki for FAQ
"" Vundle end ------------------------------------------------------------------
syntax enable
syntax on
filetype plugin indent on
colorscheme molokai
set guioptions-=r " no scrollbar on right
set guioptions-=L " no scrollbar on left
set guifont=Roboto_Mono:h12
set nobackup " no backup
set nowritebackup " no backup during edit session
set backspace=indent,eol,start " backspace over everything
set tabstop=2 " size of a tab
set shiftwidth=2 " size for auto/smartindent
set softtabstop=2 " a tab is this size
set expandtab " spaces not tabs
set smartindent " indents for you
set smarttab " tabs at start of lines
set autoindent " always set autoindenting on
set laststatus=2 " always show status line
set noswapfile
set number " display line numbers
set encoding=utf-8
set showcmd
set showmatch " show matching bracket
set vb t_vb= " no bells
set modeline " show current mode
set history=50 " keep 50 lines in history
set incsearch " do incremental search
"set completeopt-=preview " Disable scratch preview window
set relativenumber " row numbers relatives to coursor // remove with :set norelativenumber
set cursorline " paint the curent line
"set cursorcolumn " paint the current column
" Status Line
set statusline =\%2*\ %-2{GitBranch()}\ %*\ %-4t\ %m
set statusline +=\ %4*%=\ %l:%v\ %*
" NetdTree
let g:NERDTreeHijackNetrw=0
map <A-Tab> :NERDTreeToggle<CR>
"map <A-Tab> <C-W>t
" Ack
let g:ack_mappings = {
\ "t": "<C-W><CR><C-W>T",
\ "T": "<C-W><CR><C-W>TgT<C-W>j",
\ "o": "<CR>",
\ "O": "<CR><C-W>p<C-W>c",
\ "go": "<CR><C-W>p",
\ "i": "<C-W><CR><C-W>K",
\ "gi": "<C-W><CR><C-W>K<C-W>b",
\ "s": "<C-W><CR><C-W>H<C-W>b<C-W>J<C-W>t",
\ "gs": "<C-W><CR><C-W>H<C-W>b<C-W>J" }
" Alternative using Tab/Shift-Tab
map <tab> :wincmd w<CR>
map <S-tab> :wincmd W<CR>
" Moovments
nnoremap <Space> <S-M><C-D>zz
nnoremap <S-Space> <S-M><C-U>zz
" to get work on iTerm, add scape sequence to Shift+space= [25~] //http://bit.ly/2mBnzzT
set <F13>=[25~
map <F13> <S-M><C-U>zz
map! <F13> <S-M><C-U>zz
inoremap <C-h> <C-o>h
inoremap <C-j> <C-o>j
inoremap <C-k> <C-o>k
inoremap <C-l> <C-o>l
inoremap <C-a> <C-o>A
inoremap <C-b> <C-o>b
inoremap <C-w> <C-o>w
" Surround
map <C-S> ysiw
imap ( <C-S>)
imap { <C-S>}
imap [ <C-S>]
imap < <C-S>>
imap ' <C-S>'
imap " <C-S>"
imap ` <C-S>`
" Tabularize
map <C-T> :Tabularize /
" to-do colors
hi Todo guifg=#FF0000 guibg=#FF7F50
hi TODO guifg=#FF0000 guibg=#FF7F50
" Git branch
function! GitBranch()
let branch = system("git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* //'")
if branch != ''
return ' ' . substitute(branch, '\n', '', 'g') . ' '
en
return ''
endfunction
" Ctrl-P Configuration
set runtimepath^=~/.vim/bundle/ctrlp.vim
let g:ctrlp_show_hidden = 1
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.yardoc\|public$|log\|tmp\|vendor\|cache$\|node_modules\|bower_components\|target\|coverage',
\ 'file': '\.so$\|\.dat$|\.DS_Store$'
\ }
" gabrielelana/vim-markdown
let g:markdown_enable_conceal = 1
let g:markdown_mapping_switch_status = 'x'
let g:markdown_enable_insert_mode_leader_mappings = 0
" Gist
let g:gist_open_browser_after_post = 1
" vim-syntastic/syntastic
" .................................................................................
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_check_on_open = 0 " prevent long time to open files
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_loc_list_height = 5
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_wq = 1
let g:syntastic_javascript_checkers = ['eslint']
"markdown con npm install -g markdownlint-cli
" rules: https://github.com/carwin/markdown-styleguide
let g:syntastic_markdown_mdl_exec = "markdownlint"
let g:syntastic_markdown_mdl_args = ""
" custom icon and colors for molkai colorscheme
let g:syntastic_error_symbol = "✗"
let g:syntastic_warning_symbol = "!"
let g:syntastic_style_error_symbol = "x"
hi SyntasticErrorSign ctermfg=161 ctermbg=235
hi SyntasticWarningSign ctermfg=144 ctermbg=235
hi SyntasticErrorSign guifg=#F92672 guibg=#232526
hi SyntasticWarningSign guifg=#E6DB74 guibg=#232526
"ignore angular errors on html
let g:syntastic_html_tidy_ignore_errors=[ "> is not recognized!", "discarding unexpected"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment