Skip to content

Instantly share code, notes, and snippets.

@sorl
Created October 4, 2015 11:08
Show Gist options
  • Save sorl/c259e21476524dc5d1c1 to your computer and use it in GitHub Desktop.
Save sorl/c259e21476524dc5d1c1 to your computer and use it in GitHub Desktop.
execute pathogen#infect()
if has('gui_running')
let s:uname = system("uname -s")
if s:uname == "Darwin\n"
set guifont=consolas:h15
let g:latex_view_general_viewer = '/Applications/Skim.app/Contents/MacOS/Skim'
else
set guifont=Consolas\ 13
endif
endif
syntax on
set background=dark
colorscheme gruvbox
filetype on
filetype plugin on
filetype indent on
" Space, tab, indent settings
set nosmartindent " smartindent (filetype indenting instead)
set autoindent " autoindent (should be overwrote by cindent or filetype indent)
"set cindent " c-style indenting
set expandtab
set softtabstop=2
set shiftwidth=2
set tabstop=2
" Text Formatting/Layout
set shiftround " round to n x 4
set nowrap " do not wrap line
set ignorecase " case insensitive by default
set smartcase " if there are caps, go case-sensitive
set completeopt=menu,longest,preview " improve the way autocomplete works
"set cursorline " show current line
set foldcolumn=3
set encoding=utf-8 " character encoding
set ff=unix " default fileformat
set nocompatible " no need to be compatible
set modelines=5
"set mouse=a " enable mouse
set ls=2 " always show status line
set scrolloff=5 " number of context lines above and below the cursor
set showcmd " display incomplete commands
set showmode " display the current mode
set hlsearch " highlight searches
set incsearch " do incremental search
set ruler " show the cursor position all the time
set nobackup " do not keep a backup file
set title " show title in the console title bar
set ttyfast " smoother changes
set backspace=indent,eol,start " allow backspace over anything
set whichwrap=b,s,h,l,<,>,[,] " cursor
set showmatch " show matching braces
set matchtime=2 " matching time
set wildmenu " Autocomplete features in the status bar
set hidden " you can change buffer without saving
" Keyboard Mappings
" Next/Prev buffer
noremap <c-tab> :bn!<cr>
noremap <c-s-tab> :bp!<cr>
" Copy/Paste
noremap <c-s-c> "+y
inoremap <c-s-v> <C-O>"*P<return>
cnoremap <c-s-v> <C-R>+
" Switching between windows
noremap <tab> <c-w>w
noremap <s-tab> <c-w>W
" Omnicompletion
inoremap <Nul> <C-x><C-o>
" F2 - NERDTree
noremap <F2> :NERDTreeToggle<CR>
" F3 - TagList
noremap <F3> :TlistToggle<CR>
" F4 - Tasklist
noremap <F4> :TaskList<CR>
" F8 - Linewrapping
nnoremap <silent> <f8> :let &wrap = !&wrap<cr>
" F9 - Paste
set pastetoggle=<F9>
" syntastic
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_python_checkers=['flake8']
let g:syntastic_python_flake8_args="--ignore=E501,E265,E128"
nnoremap ( :lprev<CR>
nnoremap ) :lnext<CR>
inoremap ( ()<left>
inoremap " ""<left>
inoremap ' ''<left>
inoremap [ []<left>
inoremap { {}<left>
" Ctrl + Pg - Move around quickly
nnoremap <c-up> {
nnoremap <c-down> }
" Shift + Arrows - Visually Select text
nnoremap <s-up> Vk
nnoremap <s-down> Vj
nnoremap <s-right> vl
nnoremap <s-left> vh
set foldmethod=indent
set foldlevel=1000
nnoremap <space> za
vnoremap <space> zf
runtime macros/matchit.vim
au Filetype htmldjango,html,xhtml,xml,xsl source ~/.vim/scripts/closetag.vim
au Filetype htmldjango,html,xhtml source ~/.vim/scripts/wraptrans.vim
" autocmd FileType python compiler pylint
let g:closetag_html_style=1
let python_highlight_all=1
" let g:pylint_onwrite = 0 " To disable calling Pylint every time a buffer is saved put into .vimrc file
" let g:pylint_show_rate = 0 " Displaying code rate calculated by Pylint can be avoided by setting
" let g:pylint_cwindow = 0 " Openning of QuickFix window can be disabled
" NERDTree
let NERDTreeChDirMode=2
let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$', '\.swp$']
let NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
let NERDTreeShowBookmarks=1
" Taglist
let Tlist_Ctags_Cmd='/usr/bin/ctags'
let Tlist_GainFocus_On_ToggleOpen = 1 " Focus on the taglist when its toggled
let Tlist_Close_On_Select = 1 " Close when something's selected
let Tlist_Use_Right_Window = 1 " Project uses the left window
let Tlist_File_Fold_Auto_Close = 1 " Close folds for inactive files
" code completion
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html,htmldjango set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
set grepprg=grep\ -nR\ $*\ *
nmap <C-P> :cprevious
nmap <C-N> :cnext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment