Skip to content

Instantly share code, notes, and snippets.

@opt9
Last active March 28, 2018 04:15
Show Gist options
  • Save opt9/8acbbf5ccec15a6a46d1ad6e7adcffe1 to your computer and use it in GitHub Desktop.
Save opt9/8acbbf5ccec15a6a46d1ad6e7adcffe1 to your computer and use it in GitHub Desktop.
Some Linux .vimrc config
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below. If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
if has("autocmd")
filetype plugin indent on
endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set incsearch " Incremental search
set hlsearch " Highlight search
"set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes)
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
" Use 256 colours (Use this setting only if your terminal supports 256 colours)
set t_Co=256
" Set color theme
"colorscheme pablo
"colorscheme industry
colorscheme hybrid
set encoding=utf-8
set laststatus=2
" Spelling check config
autocmd BufRead,BufNewFile *.md setlocal spell spelllang=en_us
autocmd FileType gitcommit setlocal spell spelllang=en_us
set splitbelow
set splitright
" Use system clipaboard
set clipboard=unnamed
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
let g:SimpylFold_docstring_preview=1
" Remap Leader key to <space>
"let mapleader = "\<Space>"
let mapleader=","
" Easier split navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Enable Pathogen plugin manager
execute pathogen#infect()
" Directory tree config
map <Leader>d :NERDTreeToggle<CR>
" Class, Method, Function tags config
nmap <Leader>t :TagbarToggle<CR>
" Type <Space>o to open a new file
nnoremap <Leader>o :CtrlP<CR>
" Type <Space>w to save file
nnoremap <Leader>w :w<CR>
" Fuzzy search config
map <silent> <Leader>p :CtrlP()<CR>
noremap <Leader>b<space> :CtrlPBuffer<CR>
let g:ctrlp_custom_ignore = '\v[\/]dist$'
" GitGutter config
let g:gitgutter_sign_column_always = 0
" EditorConfig config
let g:EditorConfig_exclude_patterns = [ 'fugitive://.*', 'scp://.*' ]
let g:EditorConfig_exec_path = '/usr/bin/editorconfig'
" Syntax check config
map <Leader>s :SyntasticToggleMode<CR>
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" Auto complete config
let g:SuperTabDefaultCompletionType = 'context'
let g:SuperTabMappingTabLiteral = '<Tab>'
" Indent line config
let g:indentLine_char = ''
let g:indentLine_leadingSpaceChar = '·'
"let g:indentLine_leadingSpaceEnabled = 1
" tslime config
" let g:tslime_always_current_session = 1
" let g:tslime_always_current_window = 1
" vmap <C-c><C-c> <Plug>SendSelectionToTmux
" nmap <C-c><C-c> <Plug>NormalModeSendToTmux
" nmap <C-c>r <Plug>SetTmuxVars
" Python config
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
let python_highlight_all=1
let g:pymode_indent=0
let g:ale_sign_column_always=1
let g:jedi#goto_command = "<leader>D"
let g:flake8_show_in_gutter=1
"let g:syntastic_python_checkers = ['flake8', 'pylint']
let g:syntastic_python_checkers = ['flake8']
"let g:syntastic_python_pylint_args="-d C0103,C0111,R0201"
let g:syntastic_python_flake8_args='--ignore=W291,W391,E2,E265,E266,E501'
" Run google/yapf (not really a plugin but whatever)
autocmd FileType python nnoremap <LocalLeader>= :0,$!yapf<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
" Web dev config
au BufNewFile,BufRead *.js, *.html, *.css
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2
"
"" JavaScript config
"
let g:syntastic_javascript_checkers=['eslint']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment