Last active
April 7, 2018 14:58
-
-
Save medihack/4078697 to your computer and use it in GitHub Desktop.
for Vim version < 8.x
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
" Installation instructions | |
" Install Vundle -- git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle | |
" Create tmp directory -- mkdir ~/.vim/tmp | |
" Install bundles inside vim -- :PluginInstall | |
" or from the command line -- vim +PluginInstall +qall | |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
" My Plugins here: | |
" Dependecies | |
Plugin 'MarcWeber/vim-addon-mw-utils' " for vim-snipmate | |
Plugin 'tomtom/tlib_vim' " for vim-snipmate | |
Plugin 'mattn/webapi-vim' " for gist-vim | |
Plugin 'JulesWang/css.vim' " for vim-less | |
" Themes | |
Plugin 'flazz/vim-colorschemes' | |
" Languages | |
Plugin 'tpope/vim-markdown' | |
Plugin 'python-mode/python-mode' | |
Plugin 'vim-ruby/vim-ruby' | |
Plugin 'tpope/vim-rails' | |
Plugin 'skwp/vim-rspec' | |
Plugin 'tpope/vim-git' | |
Plugin 'briancollins/vim-jst' | |
Plugin 'slava/vim-spacebars' | |
Plugin 'mmalecki/vim-node.js' | |
Plugin 'vim-scripts/csv.vim' | |
Plugin 'othree/html5.vim' | |
Plugin 'genoma/vim-less' | |
Plugin 'vim-scripts/django.vim' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'mxw/vim-jsx' | |
Plugin 'mustache/vim-mustache-handlebars' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'elixir-lang/vim-elixir' | |
Plugin 'posva/vim-vue' | |
" Tools | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'EvanDotPro/nerdtree-chmod' | |
Plugin 'mileszs/ack.vim' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Plugin 'medihack/sh.vim' | |
Plugin 'jeetsukumaran/vim-buffergator' | |
Plugin 'mkitt/tabline.vim' | |
Plugin 'tpope/vim-endwise' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'mattn/gist-vim' | |
Plugin 'sjl/gundo.vim' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'vim-scripts/Rename2' | |
Plugin 'garbas/vim-snipmate' | |
Plugin 'honza/vim-snippets' | |
Plugin 'ervandew/supertab' | |
Plugin 'tpope/vim-surround' | |
Plugin 'majutsushi/tagbar' | |
Plugin 'tpope/vim-unimpaired' | |
Plugin 'vim-scripts/vimwiki' | |
Plugin 'regedarek/ZoomWin' | |
Plugin 'tmhedberg/matchit' | |
Plugin 'michaeljsmith/vim-indent-object' | |
Plugin 'ap/vim-css-color' | |
Plugin 'chrisbra/NrrwRgn' | |
Plugin 'skalnik/vim-vroom' | |
Plugin 'vim-scripts/mru.vim' | |
Plugin 'bitc/vim-bad-whitespace' | |
Plugin 'ivanov/vim-ipython' | |
" Unused | |
"Plugin 'xolox/vim-misc' " dependency for vim-session | |
"Plugin 'xolox/vim-session' " conflict swith CUA editor shortcuts | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" | |
" Normal Vim config: | |
" | |
set number | |
set ruler | |
syntax on | |
" Default color scheme | |
if has('gui_running') | |
set background=dark | |
colorscheme solarized | |
else | |
set t_Co=256 | |
" only needs to be set when not using an Putty Solarized color scheme | |
" https://github.com/altercation/solarized/tree/master/putty-colors-solarized | |
"let g:solarized_termcolors=256 | |
set background=light | |
colorscheme solarized | |
" alterlative good looking theme | |
"colorscheme jellybeans | |
endif | |
" enable horizontal scrollbar | |
set guioptions+=b | |
" Set encoding | |
set encoding=utf-8 | |
" Whitespace stuff | |
set nowrap | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=2 | |
set expandtab | |
set listchars=tab:>-,trail:. | |
" Searching | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
" Tab completion | |
set wildmode=list:longest,list:full | |
" Ignore files on tab completion, ctrl-p and ack.vim | |
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* | |
set wildignore+=.meteor | |
set wildignore+=node_modules | |
" Status bar | |
set laststatus=2 | |
" Without setting this, ZoomWin restores windows in a way that causes | |
" equalalways behavior to be triggered the next time CommandT is used. | |
" This is likely a bludgeon to solve some other issue, but it works | |
set noequalalways | |
" Make , the leader key | |
let mapleader = "," | |
" resize window | |
map <C-j> <C-W>- | |
map <C-k> <C-W>+ | |
map <C-l> <C-W>> | |
map <C-h> <C-W>< | |
" Allow to resize windows and select tabs with mouse in terminal vim | |
" Unfortunately makes copy&paste with mouse cumbersome, but let's try | |
set mouse=a | |
" Remember last location in file | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
\| exe "normal g'\"" | endif | |
endif | |
" make uses real tabs | |
au FileType make set noexpandtab | |
" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby | |
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby | |
" add json syntax highlighting | |
au BufNewFile,BufRead *.json set ft=javascript | |
" use zsh syntax highlighting for also for bash (better) | |
au BufNewFile,BufRead *.sh set ft=zsh | |
" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ ) | |
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79 | |
" make javascript to use jQuery code style | |
" Rails.vim always overrides the above (with autoload) but allows this: | |
au User Rails/**/*.js set shiftwidth=2 softtabstop=2 expandtab=1 | |
" and also set it for non Rails Javascript files | |
au FileType javascript set shiftwidth=2 softtabstop=2 expandtab | |
" make htmldjango use 4 spaces as Django | |
au FileType htmldjango set softtabstop=4 tabstop=4 shiftwidth=4 expandtab | |
" shortcuts to enable Django templates syntax in .html files | |
autocmd BufEnter *html map <F8> :setfiletype htmldjango<CR> | |
autocmd BufEnter *html map <S-F8> :setfiletype django<CR> | |
" shortcut to enable Handlebars templates syntax in .html files | |
autocmd BufEnter *html map <F9> :setfiletype html syntax=mustache<CR> | |
au FileType html set softtabstop=2 tabstop=2 shiftwidth=2 expandtab | |
" allow backspacing over everything in insert mode | |
set backspace=indent,eol,start | |
" load the plugin and indent settings for the detected filetype | |
filetype plugin indent on | |
" Opens an edit command with the path of the currently edited file filled in | |
" Normal mode: <Leader>e | |
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR> | |
" Opens a tab edit command with the path of the currently edited file filled in | |
" Normal mode: <Leader>t | |
map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR> | |
" Inserts the path of the currently edited file into a command | |
" Command mode: Ctrl+P | |
cmap <C-P> <C-R>=expand("%:p:h") . "/" <CR> | |
" Unimpaired configuration | |
" Bubble single lines | |
nmap <C-Up> [e | |
nmap <C-Down> ]e | |
" Bubble multiple lines | |
vmap <C-Up> [egv | |
vmap <C-Down> ]egv | |
" Use modeline overrides | |
set modeline | |
set modelines=10 | |
" Directories for swp files | |
set backupdir=~/.vim/tmp | |
set directory=~/.vim/tmp | |
" % to bounce from do to end etc. | |
runtime! macros/matchit.vim | |
" Show (partial) command in the status line | |
set showcmd | |
" Include user's local vim config | |
if filereadable(expand("~/.vimrc.local")) | |
source ~/.vimrc.local | |
endif | |
" use system clipboard for yanking and deleting | |
if has('unnamedplus') | |
set clipboard=unnamedplus | |
else | |
set clipboard=unnamed | |
endif | |
" allow deleting selection without updating the clipboard (yank buffer) | |
vnoremap x "_x | |
vnoremap X "_X | |
" no bells at all | |
set noerrorbells | |
set novisualbell | |
" Indent with Tab in visual mode | |
vmap <Tab> >gv | |
vmap <S-Tab> <gv | |
" make öö leave edit mode | |
imap öö <Esc> | |
" Stay in visual mode after indent | |
" see http://vim.wikia.com/wiki/Shifting_blocks_visually | |
vnoremap > >gv | |
vnoremap < <gv | |
" Always display the status line (current mode, filename, ...) | |
set laststatus=2 | |
" For webpack hot module replacement (HMR) to work | |
" see https://github.com/webpack/webpack/issues/781 | |
set backupcopy=yes | |
" always use working directory as start point for search in ctrlp | |
let g:ctrlp_working_path_mode = 0 | |
" List index files in ctrlp | |
"let g:ctrlp_show_hidden = 1 # this would also list files like .pyc | |
let g:ctrlp_dotfiles = 1 | |
" NERDTree configuration | |
let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$'] | |
map <Leader>n :NERDTreeToggle<CR> | |
map <Leader>s :NERDTreeFind<CR> | |
let NERDTreeShowHidden=1 | |
" Buffergator configuration | |
let g:buffergator_viewport_split_policy = "T" | |
let g:buffergator_split_size = 10 | |
let g:buffergator_autoexpand_on_split = 0 | |
" ZoomWin configuration | |
map <Leader><Leader> :ZoomWin<CR> | |
" CTags | |
map <Leader>rt :!ctags --extra=+f -R *<CR><CR> | |
map <C-\> :tnext<CR> | |
" Enable syntastic syntax checking | |
let g:syntastic_enable_signs=1 | |
let g:syntastic_quiet_messages = {'level': 'warnings'} | |
" setup syntastic code checker for javascript | |
" jshint does not work with react | |
"let g:syntastic_javascript_checkers = ['jshint'] " sudo npm install jshint -g | |
" eslint works with jsx | |
" see https://github.com/medihack/syntastic-react | |
" and http://eslint.org/docs/user-guide/configuring | |
let g:syntastic_javascript_checkers = ['eslint'] | |
" 'scss' checker has problems in rails | |
" make sure scss-lint gem is installed in current version (>= 0.17) | |
" currently not needed as I am not using rails | |
"let g:syntastic_scss_checkers = ['scss_lint'] | |
" setup syntastic code checker for python | |
let g:syntastic_python_checkers = ['flake8'] " pip install flake8 | |
" disable several syntastic flake8 errors | |
" (disables "too long lines", "2 spaces before function def") | |
let g:syntastic_python_flake8_post_args='--ignore=E302,E501' | |
" disable several pylint errors of syntastic | |
" (not used for now as I use flake8 as syntastic python checker) | |
"let g:syntastic_python_pylint_args='--disable=F0401,E1101 -f parseable -r n -i y' | |
" remap pymode toggle breakpoint as it conflicts with buffergator | |
let g:pymode_breakpoint_bind = '<leader>p' | |
" let syntastic handle code checking of python code and not python mode, | |
let g:pymode_lint = 0 | |
" not used currently as I use syntastic for code checking, see below | |
" disable pylint options of python-mode | |
" let g:pymode_lint = 1 | |
" let g:pymode_lint_ignore = "E501,C901" | |
" disable folding in python code (enabled by default in klen/python-mode) | |
let g:pymode_folding = 0 | |
" Turn off rope in python-mode | |
let g:pymode_rope = 0 | |
" gist-vim defaults | |
if has("mac") | |
let g:gist_clip_command = 'pbcopy' | |
elseif has("unix") | |
let g:gist_clip_command = 'xclip -selection clipboard' | |
endif | |
let g:gist_detect_filetype = 1 | |
let g:gist_open_browser_after_post = 1 | |
" Turn off jslint errors by default | |
let g:JSLintHighlightErrorLine = 0 | |
" MacVIM shift+arrow-keys behavior (required in .vimrc) | |
let macvim_hig_shift_movement = 1 | |
" make ack under Ubuntu available in vim | |
let g:ackprg="ack-grep -H --nocolor --nogroup --column" | |
" make ack.vim use ack-grep command under debian/ubuntu | |
let g:ackprg="ack-grep -H --nocolor --nogroup --column" | |
" Show recently used files (using mru.vim plugin) | |
map <leader>f :MRU<CR> | |
" Better indentations for shell scripts (uses sh.vim plugin) | |
let g:sh_indent_case_labels=1 | |
" vim-airline configuration | |
let g:airline_theme = 'solarized' | |
let g:airline_solarized_bg = 'dark' | |
" Use the default set of separators with a few customizations | |
if !exists('g:airline_powerline_fonts') | |
let g:airline_left_sep=' ›' " Slightly fancier than '>' | |
let g:airline_right_sep='‹ ' " Slightly fancier than '<' | |
endif | |
" Show the name of the currently active git branch | |
let g:airline#extensions#branch#enabled = 1 | |
" Show open buffer on top | |
let g:airline#extensions#tabline#enabled = 1 | |
" Allow JSX inside JS files | |
" see https://github.com/mxw/vim-jsx | |
let g:jsx_ext_required = 0 | |
" For project specific settings | |
set exrc | |
set secure | |
""" | |
" Unused old stuff | |
""" | |
" not using this anymore as it takes forever | |
" Source the vimrc file after saving it (from vimcasts.org) | |
"if has("autocmd") | |
"autocmd bufwritepost .vimrc source $MYVIMRC | |
"endif | |
" Automatically save and reload sessions | |
" let g:session_autoload = 1 | |
" let g:session_autosave = 'no' | |
" CUA (Windows) editor shortcuts (CTRL + X/C/V) | |
"source $VIMRUNTIME/mswin.vim | |
" Disable automatic line breaks for markdown | |
" au FileType markdown set textwidth=0 | |
" Try to fix the redrawing problem in Ubuntu | |
"set ttyfast | |
"set ttyscroll=0 | |
"set guioptions=agim |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment