Last active
February 9, 2016 15:52
-
-
Save dardourimohamed/2efca140c70035ecce10 to your computer and use it in GitHub Desktop.
My favourite vim modules
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
" File: .vimrc | |
" Author: Jake Zimmerman <jake@zimmerman.io> | |
" | |
" How I configure Vim :P | |
" | |
" Gotta be first | |
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
" ----- Making Vim look good ------------------------------------------ | |
" Plugin 'altercation/vim-colors-solarized' | |
Plugin 'tomasr/molokai' | |
Plugin 'bling/vim-airline' | |
" ----- Vim as a programmer's text editor ----------------------------- | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'jistr/vim-nerdtree-tabs' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'xolox/vim-misc' | |
Plugin 'xolox/vim-easytags' | |
Plugin 'majutsushi/tagbar' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'vim-scripts/a.vim' | |
" ----- Working with Git ---------------------------------------------- | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'tpope/vim-fugitive' | |
" ----- Other text editing features ----------------------------------- | |
Plugin 'Raimondi/delimitMate' | |
" ----- man pages, tmux ----------------------------------------------- | |
Plugin 'jez/vim-superman' | |
Plugin 'christoomey/vim-tmux-navigator' | |
" ----- Syntax plugins ------------------------------------------------ | |
Plugin 'jez/vim-c0' | |
Plugin 'jez/vim-ispc' | |
Plugin 'kchmck/vim-coffee-script' | |
" ---- Extras/Advanced plugins ---------------------------------------- | |
" Highlight and strip trailing whitespace | |
Plugin 'ntpeters/vim-better-whitespace' | |
" Easily surround chunks of text | |
Plugin 'tpope/vim-surround' | |
" Align CSV files at commas, align Markdown tables, and more | |
Plugin 'godlygeek/tabular' | |
" Automaticall insert the closing HTML tag | |
Plugin 'HTML-AutoCloseTag' | |
" Make tmux look like vim-airline (read README for extra instructions) | |
Plugin 'edkolev/tmuxline.vim' | |
" All the other syntax plugins I use | |
Plugin 'ekalinin/Dockerfile.vim' | |
Plugin 'digitaltoad/vim-jade' | |
Plugin 'tpope/vim-liquid' | |
Plugin 'cakebaker/scss-syntax.vim' | |
Plugin 'aurigadl/vim-angularjs' | |
Plugin 'jelera/vim-javascript-syntax' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'nathanaelkane/vim-indent-guides' | |
Plugin 'Valloric/YouCompleteMe' | |
Plugin 'marijnh/tern_for_vim' | |
Plugin 'severin-lemaignan/vim-minimap' | |
call vundle#end() | |
filetype plugin indent on | |
" --- General settings --- | |
set backspace=indent,eol,start | |
set ruler | |
set number | |
set showcmd | |
set incsearch | |
set hlsearch | |
let g:syntastic_check_on_open=1 | |
let g:ycm_add_preview_to_completeopt=0 | |
let g:ycm_confirm_extra_conf=0 | |
set completeopt-=preview | |
set nowrap | |
" size of a hard tabstop | |
set tabstop=2 | |
" size of an "indent" | |
set shiftwidth=2 | |
" a combination of spaces and tabs are used to simulate tab stops at a width | |
" other than the (hard)tabstop | |
set softtabstop=2 | |
:set regexpengine=1 | |
:syntax enable | |
syntax on | |
let mapleader="²" | |
set mouse=a | |
" ----- Plugin-Specific Settings -------------------------------------- | |
" Toggle this to "light" for light colorscheme | |
set background=dark | |
set t_Co=256 | |
syntax on | |
set background=dark | |
colorscheme distinguished | |
" ----- bling/vim-airline settings ----- | |
" Always show statusbar | |
set laststatus=2 | |
" Fancy arrow symbols, requires a patched font | |
" To install a patched font, run over to | |
" https://github.com/abertsch/Menlo-for-Powerline | |
" download all the .ttf files, double-click on them and click "Install" | |
" Finally, uncomment the next line | |
" let g:airline_powerline_fonts = 1 | |
" set guifont=Literation\ Mono\ Powerline | |
" Show PASTE if in paste mode | |
let g:airline_detect_paste=1 | |
" Show airline for tabs too | |
let g:airline#extensions#tabline#enabled = 1 | |
" ----- jistr/vim-nerdtree-tabs ----- | |
" Open/close NERDTree Tabs with \t | |
nmap <silent> <leader>² :NERDTreeTabsToggle<CR> | |
" To have NERDTree always open on startup | |
let g:nerdtree_tabs_open_on_console_startup = 0 | |
" ----- scrooloose/syntastic settings ----- | |
let g:syntastic_error_symbol = '✘' | |
let g:syntastic_warning_symbol = "▲" | |
augroup mySyntastic | |
au! | |
au FileType tex let b:syntastic_mode = "passive" | |
augroup END | |
" ----- xolox/vim-easytags settings ----- | |
" Where to look for tags files | |
set tags=./tags;,~/.vimtags | |
" Sensible defaults | |
let g:easytags_events = ['BufReadPost', 'BufWritePost'] | |
let g:easytags_async = 1 | |
let g:easytags_dynamic_files = 2 | |
let g:easytags_resolve_links = 1 | |
let g:easytags_suppress_ctags_warning = 1 | |
" ----- majutsushi/tagbar settings ----- | |
" Open/close tagbar with \b | |
nmap <silent> <leader>b :TagbarToggle<CR> | |
" Uncomment to open tagbar automatically whenever possible | |
" autocmd BufEnter * nested :call tagbar#autoopen(0) | |
" ----- airblade/vim-gitgutter settings ----- | |
" Required after having changed the colorscheme | |
hi clear SignColumn | |
" In vim-airline, only display "hunks" if the diff is non-zero | |
let g:airline#extensions#hunks#non_zero_only = 1 | |
" ----- Raimondi/delimitMate settings ----- | |
let delimitMate_expand_cr = 1 | |
augroup mydelimitMate | |
au! | |
au FileType markdown let b:delimitMate_nesting_quotes = ["`"] | |
au FileType tex let b:delimitMate_quotes = "" | |
au FileType tex let b:delimitMate_matchpairs = "(:),[:],{:},`:'" | |
au FileType python let b:delimitMate_nesting_quotes = ['"', "'"] | |
augroup END | |
" yui-compressor and closure-compiler and less and scss: | |
" http://blog.othree.net/log/2009/12/26/javascript-on-vim/ | |
function! Fe_compress () | |
let cwd = expand('%:p:h') | |
let nam = expand('%:t:r') | |
let ext = expand('%:e') | |
let cssnam = nam.'.css' | |
if ext == 'less' | |
if filewritable(cwd.'/'.cssnam) | |
cal system( 'lessc '.cwd.'/'.nam.'.'.ext.' > '.cwd.'/'.cssnam.' &') | |
cal Css_compress() | |
endif | |
elseif ext == 'scss' | |
if filewritable(cwd.'/'.cssnam) | |
cal system( 'sass '.cwd.'/'.nam.'.'.ext.' > '.cwd.'/'.cssnam.' &') | |
cal Css_compress() | |
endif | |
elseif ext == 'css' | |
cal Css_compress() | |
elseif ext == 'js' | |
if -1 == match(nam, "[\._]src$") | |
let minfname = nam.".min.".ext | |
else | |
let minfname = substitute(nam, "[\._]src$", "", "g").".".ext | |
endif | |
if filewritable(cwd.'/'.minfname) | |
cal system( s:jscompressor.' '.cwd.'/'.nam.'.'.ext.' > '.cwd.'/'.minfname.' &') | |
endif | |
endif | |
endfunction | |
function! Css_compress () | |
let cwd = expand('%:p:h') | |
let nam = expand('%:t:r') | |
let ext = "css" | |
if -1 == match(nam, "[\._]src$") | |
let minfname = nam.".min.".ext | |
else | |
let minfname = substitute(nam, "[\._]src$", "", "g").".".ext | |
endif | |
if filewritable(cwd.'/'.minfname) | |
cal system( 'yui-compressor '.cwd.'/'.nam.'.'.ext.' > '.cwd.'/'.minfname.' &') | |
endif | |
endfunction | |
if executable('uglifyjs') || executable('closure-compiler') || executable('closure') || executable('yui-compressor') | |
autocmd FileWritePost,BufWritePost *.js :call Fe_compress() | |
if executable('uglifyjs') | |
let s:jscompressor = 'uglifyjs' | |
elseif executable('closure-compiler') | |
let s:jscompressor = 'closure-compiler --js' | |
elseif executable('closure') | |
let s:jscompressor = 'closure --js' | |
elseif executable('yui-compressor') | |
let s:jscompressor = 'yui-compressor' | |
endif | |
endif | |
if executable('lessc') | |
autocmd FileWritePost,BufWritePost *.less :call Fe_compress() | |
endif | |
if executable('sass') | |
autocmd FileWritePost,BufWritePost *.scss :call Fe_compress() | |
endif | |
if executable('yui-compressor') | |
autocmd FileWritePost,BufWritePost *.css :call Css_compress() | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
save this to
~/.vimrc
run
sudo apt-get install git python-dev vim-nox cmake build-essential nodejs npm uglifyjs closure-compiler yui-compressor
npm install -g tern
mkdir ~/.vim/colors
wget https://raw.githubusercontent.com/Lokaltog/vim-distinguished/develop/colors/distinguished.vim ~/.vim/colors
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
~/.vim/bundle/YouCompleteMe/install.py --clang-completer
The leader key is ²
Toggle file explorer ²+²
Open file in new tab t
Switch cursor between files explorer and file editor Ctrl+w+w
Switch between tabs g+t or g+T