Skip to content

Instantly share code, notes, and snippets.

@spellancer
Created June 16, 2017 21:10
Show Gist options
  • Save spellancer/8b0f3a42a1b70fdbb17dad65642e91f3 to your computer and use it in GitHub Desktop.
Save spellancer/8b0f3a42a1b70fdbb17dad65642e91f3 to your computer and use it in GitHub Desktop.
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/vundle'
Plugin 'mileszs/ack.vim'
Plugin 'avakhov/vim-yaml'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'jlanzarotta/bufexplorer'
Plugin 'kien/ctrlp.vim'
Plugin 'Shougo/unite.vim'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'szw/vim-tags'
Plugin 'saltstack/salt-vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-eunuch'
Plugin 'mattn/gist-vim'
" For python & indent
Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
Bundle 'Valloric/YouCompleteMe'
Plugin 'scrooloose/syntastic'
Plugin 'nvie/vim-flake8'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-repeat'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'honza/vim-snippets'
Plugin 'mattn/emmet-vim'
Plugin 'tpope/vim-dispatch'
Plugin 'bling/vim-airline'
Plugin 'edkolev/tmuxline.vim'
Plugin 'jceb/vim-orgmode'
Plugin 'tpope/vim-bundler'
Plugin 'plasticboy/vim-markdown'
Plugin 'tpope/vim-git'
Plugin 'slim-template/vim-slim'
Plugin 'digitaltoad/vim-jade'
Plugin 'wting/rust.vim'
Plugin 'jnwhiteh/vim-golang'
Plugin 'maksimr/vim-yate'
Plugin 'wavded/vim-stylus'
Plugin 'daylerees/colour-schemes', { 'rtp': 'vim/' }
Plugin 'sjl/badwolf'
Plugin 'chriskempson/vim-tomorrow-theme'
Plugin 'dhruvasagar/vim-railscasts-theme'
Plugin 'altercation/vim-colors-solarized'
Plugin 'tomasr/molokai'
call vundle#end()
let python_highlight_all=1 "python
syntax on
set clipboard=unnamed
filetype plugin indent on " Required for Vundle
syntax enable
" Docstring for folded functions
let g:SimpylFold_docstring_preview=1
set nowrap " Don't wrap lines
set scrolloff=7 " Show 3 lines of context around the cursor.
set tabstop=4 shiftwidth=4 " A tab is two spaces
set expandtab " Use spaces, not tabs
set backspace=indent,eol,start " Backspace through everything in insert mode
set modelines=0 " Preventing some security exploits.
set showcmd " Display incomplete commands and mode you're in
set showmode
set linespace=4 " Add some line space for easy reading.
set visualbell " Disable visual bell.
set encoding=utf-8 " Set main encoding.
set autoindent
set hidden " Handle multiple buffers better.
set wildmenu " Enhanced command line completion.
set wildmode=list:longest
set title " Set the terminal's title.
set ttyfast " Indicates a fast terminal connection.
set ruler " Show the current line and column number.
set number " Show line numbers.
set laststatus=2 " Show the status line all the time.
hi StatusLine ctermbg=white ctermfg=darkblue
hi StatusLineNC ctermbg=black ctermfg=grey
highlight Search ctermfg=White ctermbg=Blue
set ignorecase " Case-sensitive search.
set smartcase
set gdefault " Applying substitutions globally on lines.
set incsearch " Highlighting search results.
set showmatch
set hlsearch
"set wrap " Making Vim handle long lines correctly.
"set textwidth=79
"set linebreak
"set formatoptions=qrn1
"set colorcolumn=85
set list " Better invisible characters.
set listchars=tab:▸\ ,eol:¬
set mouse=a " Some stuff to get the mouse going in term.
set ttymouse=xterm2
set splitbelow
set splitright
set wildmenu
set wildmode=list:longest,full
let mapleader = "," " Setup leader key.
" Switch invisible characters
map <leader>i :set list!<CR>
" Delete all trailing whitespacces
map <leader>u :%s/\s\+$//<CR>
" Easier commands
nnoremap ; :
vnoremap ; :
" Turning off vim's regex chars
nnoremap / /\v
vnoremap / /\v
nnoremap <leader>a :Ack
" Re-hardwrap paragraphs of text
nnoremap <leader>q gqip
" Reselect pasted text
nnoremap <leader>v V`]
" Quicker Escaping
inoremap jj <ESC>
" Working with split windows
nnoremap <leader>g <C-w>v<C-w>l
nnoremap <leader>s <C-w>s<C-w>l
" Navigating around the splits
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" NERDTree keys.
silent! nmap <silent> <Leader>p :NERDTreeToggle<CR>
nnoremap <silent> <C-f> :call FindInNERDTree()<CR>
" Map to bufexplorer
nnoremap <leader>e :BufExplorer<cr>
" Tab mappings
map <leader>tt :tabnew<CR>
map <leader>te :tabedit
map <leader>tc :tabclose<CR>
map <leader>to :tabonly<CR>
map <leader>tn :tabnext<CR>
map <leader>tp :tabprevious<CR>
map <leader>tf :tabfirst<CR>
map <leader>tl :tablast<CR>
map <leader>tm :tabmove
map <leader>m :set nu!<CR>:set paste!<CR>:set list!<CR>
" vim-gitgutter
map <leader>tg :GitGutterToggle<CR>
" let g:gitgutter_enabled = 0
" ctrlp.vim
" map <leader>f :CtrlPMixed<CR>
" Clear out a search
nnoremap <leader><space> :noh<cr>
" GUI
set antialias
set mouse=a
set guioptions-=T " no toolbar set guioptions-=m " no menus
set guioptions-=r " no scrollbar on the right
set guioptions-=R " no scrollbar on the right
set guioptions-=l " no scrollbar on the left
set guioptions-=b " no scrollbar on the bottom
set guioptions=aiA
set noerrorbells visualbell t_vb=
autocmd GUIEnter * set visualbell t_vb=
set gfn=Droid\ Sans\ Mono\ for\ Powerline\ 11
" Russian key maps
" Fast switch between two last files
nnoremap <leader><leader> <c-^>
" gist-vim
let g:gist_open_browser_after_post = 1
let g:gist_post_private = 1
let g:gist_detect_filetype = 1
" mustache
let g:mustache_abbreviations = 1
" literate coffeescript
autocmd FileType litcoffee runtime ftplugin/coffee.vim
" custom syntax highlighting
au BufRead,BufNewFile {Capfile,Gemfile,Rakefile,Thorfile,bluepill.pill,config.ru,.caprc,.irbrc,irb_tempfile*} set ft=ruby
" turn off default mode indicator
" set noshowmode
" airline
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" let g:airline#extensions#tabline#tab_min_count = 1
" disable markdown folding
let g:vim_markdown_folding_disabled=1
" Line under the status line
set ruf=%32(%l\ %c\ [%Y/%{&ff}/%{strlen(&fenc)?&fenc:'none'}]\ %p%%%)
" Go settings
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_trailing_whitespace_error = 0
hi IndentGuidesOdd ctermbg=black
hi IndentGuidesEven ctermbg=darkgrey
set ts=2 sw=2 et
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
"
" Enable folding
" set foldmethod=indent
" set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
au BufNewFile,BufRead *.js, *.html, *.css
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2
highlight BadWhitespace ctermbg=red guibg=darkred
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
set encoding=utf-8
let g:ycm_autoclose_preview_window_after_completion=1
"map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
"python with virtualenv support
py << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.yardoc\|public$|log\|tmp$',
\ 'file': '\.so$\|\.dat$|\.DS_Store$'
\ }
let g:ctrlp_show_hidden = 1
let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp'
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
if executable('ag')
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
endif
autocmd FileType python nnoremap <buffer> <F9> :exec '!python' shellescape(@%, 1)<cr>
" Navigation between split windows
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment