Skip to content

Instantly share code, notes, and snippets.

@OrderAndCh4oS
Last active May 28, 2019 22:34
Show Gist options
  • Save OrderAndCh4oS/49ddc28ac0677d6acdcff565673e1381 to your computer and use it in GitHub Desktop.
Save OrderAndCh4oS/49ddc28ac0677d6acdcff565673e1381 to your computer and use it in GitHub Desktop.
.vimrc
set nocompatible
filetype off " required
syntax enable
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'vim-syntastic/syntastic'
Plugin 'fugitive.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'TagBar'
Plugin 'Chiel92/vim-autoformat'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'ntpeters/vim-better-whitespace'
Plugin 'splitjoin.vim'
Plugin 'airblade/vim-gitgutter'
Bundle 'stephpy/vim-php-cs-fixer'
Plugin 'mattn/emmet-vim'
Plugin 'lilydjwg/colorizer'
Plugin 'junegunn/goyo.vim'
Plugin 'junegunn/limelight.vim'
Plugin 'vimlatex'
Plugin 'plantuml-syntax'
Plugin 'nvie/vim-flake8'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'ervandew/supertab'
Plugin 'ryanoasis/vim-devicons'
call vundle#end() " required
filetype plugin indent on " require
let python_highlight_all=1
let g:ycm_confirm_extra_conf = 0
let mapleader = ","
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let NERDTreeQuitOnOpen=1
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\.pyc$', '\~$']
let g:webdevicons_enable_nerdtree = 1
let g:ctrlp_working_path_mode = 'ra'
let loaded_matchparen = 1
let g:molokai_original = 1
scriptencoding utf-8
set encoding=utf-8
set guifont=DroidSansMono\ Nerd\ Font\ 14
set mouse=a
set fenc=utf-8
set termencoding=utf-8
set number
" set spell spelllang=en_gb
set ruler
set shiftround
set ts=4
set autoindent
set smartindent
set expandtab
set smarttab
set shiftwidth=4
set history=500
set autoread
set list
set listchars=tab:\ \ ,trail:.
set colorcolumn=80
set backspace=2 " backspace delete over EOL
highlight ColorColumn ctermbg=236
hi CursorLine cterm=NONE ctermbg=236
set laststatus=2
set statusline=%t
set statusline+=%*
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 0
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
autocmd FileType make setlocal noexpandtab
autocmd BufWritePre * StripWhitespace
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd FileType python setlocal completeopt-=preview
autocmd FileType nerdtree setlocal ambiwidth=double
" edit vimrc
nnoremap <Leader>ev :e ~/.vimrc<CR>
" source .vimrc
nnoremap <Leader>sv :so ~/.vimrc<CR>
" turn a snake into a camel
nnoremap <Leader>+ mmviw:s/\%V_\(.\)/\U\1/g<CR>:nohlsearch<CR>`m
" turn a camel into a snake
nnoremap <Leader>_ mmviw:s/\%V\(\u\)/_\L\1/g<CR>:nohlsearch<CR>`m
" search and replace
nnoremap <Leader>rr :%s//g<Left><Left>
" search and replace current word
nnoremap <Leader>rw :%s/<c-r><c-w>//g<left><left>
" increment/decrement numbers
nnoremap + <C-a>
nnoremap - <C-x>
" toggle goyo
nnoremap <Leader>gy :Goyo<CR>
autocmd! User GoyoEnter Limelight
autocmd! User GoyoLeave Limelight!
"save current buffer
nnoremap <leader>w :w<cr>
nnoremap <leader>q :q<cr>
nnoremap <leader>wq :wq<cr>
"create a new buffer (save it with :w ./path/to/FILENAME)
nnoremap <leader>b :enew<cr>
""close current buffer
nnoremap <leader>bq :bp <bar> bd! #<cr>
"close all open buffers
nnoremap <leader>ba :bufdo bd!<cr>
" move by single line
nnoremap j gj
nnoremap k gk
" Replace occurences
" `cgn`
" Type the replacement
" then `.`
" replaces the next occurrence
" and `n`
" skips the next
nnoremap <Leader>gg :nnoremap j gj<CR>:nnoremap k gk<CR>
nnoremap <Leader>gx :nunmap j<CR>:nunmap k<CR>
nmap ,p :w<CR>:!python %<CR>
nmap ,v :w<CR>:!venv/bin/python %<CR>
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
map <C-n> :NERDTreeToggle<CR>
nmap <C-Right> :bnext<CR>
nmap <C-Left> :bprev<CR>
nmap <C-t> :TagbarToggle<CR>
noremap <F3> :Autoformat<CR>
map <F9> :YcmCompleter FixIt<CR>
nnoremap <F5> :!yarn start<CR>
nnoremap <F6> :!yarn build<CR>
nnoremap <F7> :make<CR>
if &term =~ '^screen'
" tmux will send xterm-style keys when its xterm-keys option is on
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
endif
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment