Skip to content

Instantly share code, notes, and snippets.

@alyssaq
Created May 4, 2015 02:04
Show Gist options
  • Save alyssaq/1138659e94900838e60e to your computer and use it in GitHub Desktop.
Save alyssaq/1138659e94900838e60e to your computer and use it in GitHub Desktop.
.vimrc
set encoding=utf-8
autocmd! bufwritepost .vimrc source %
filetype off
filetype plugin indent on
syntax on
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2
au BufRead,BufNewFile *.scss set filetype=scss.css
let g:html_indent_inctags = "html,body,head,tbody"
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"
set grepprg=ack\ -k
" Javascript
" ==========
let jshint2_save = 1
let g:syntastic_javascript_checkers = ['eslint']
let g:jsx_ext_required = 0
set smarttab
set cindent
" DelimitMate
" ===========
let delimitMate_expand_cr = 1
" No folding magic
" =========================
set foldmethod=syntax
set foldnestmax=2
nnoremap <space> zA
vnoremap <space> zA
au BufRead * normal zR
" When opening the file, unfold all. Fold all with zM
" au BufRead * normal zR
" UltiSnips
" =========
set runtimepath+=~/.vim/bundle/UltiSnips
set runtimepath+=~/.vim/ulti_snippets
let g:UltiSnipsSnippetsDir = "~/.vim/ulti_snippets/"
let g:UltiSnipsSnippetDirectories = ['UltiSnips', 'ulti_snippets']
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" Tagbar
" ======
nmap <F8> :TagbarToggle<CR>
" General option
" ===============
let mapleader = "," " rebind <Leader> key
nnoremap . <NOP>
set wildmode=list:longest " make TAB behave like in a shell
set autoread " reload file when changes happen in other editors
set tags=./tags
set mouse=a
set bs=2 " make backspace behave like normal again
set wildignore+=*.pyc
set wildignore+=*_build/*
set wildignore+=*/coverage/*
" Disable stupid backup and swap files - they trigger too many events
" for file system watchers
set nobackup
set nowritebackup
set noswapfile
" make yank copy to the global system clipboard
set clipboard=unnamed
" found here: http://stackoverflow.com/a/2170800/70778
function! OmniPopup(action)
if pumvisible()
if a:action == 'j'
return "\<C-N>"
elseif a:action == 'k'
return "\<C-P>"
endif
endif
return a:action
endfunction
inoremap <silent><C-j> <C-R>=OmniPopup('j')<CR>
inoremap <silent><C-k> <C-R>=OmniPopup('k')<CR>
set history=700
set undolevels=700
set tabstop=2
set softtabstop=2
set shiftwidth=2
set shiftround
set expandtab
" disable formatting when pasting large chunks of code
set pastetoggle=<F2>
set hlsearch
set incsearch
set ignorecase
set smartcase
set nowrap " don't automatically wrap on load
set tw=80 " width of document (used by gd)
set fo-=t " don't automatically wrap text when typing
" Awesome line number magic
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
nnoremap <Leader>l :call NumberToggle()<cr>
:au FocusLost * set number
:au FocusGained * set relativenumber
autocmd InsertEnter * set number
autocmd InsertLeave * set relativenumber
set relativenumber
" center the cursor vertically
:nnoremap <Leader>zz :let &scrolloff=999-&scrolloff<CR>
" easier formatting of paragraphs
vmap Q gq
nmap Q gqap
" Settings for jedi-vim
" =====================
let g:jedi#usages_command = "<leader>n"
let g:jedi#popup_on_dot = 0
let g:jedi#popup_select_first = 0
map <Leader>b Oimport ipdb; ipdb.set_trace() # BREAKPOINT<C-c>
" Settings for vim-powerline
" ===========================
set laststatus=2
" let g:Powerline_symbols = 'fancy'
" Settings for vim-markdown
" ==========================
" let g:vim_markdown_folding_disabled=1
let g:vim_markdown_initial_foldlevel=1
" Settings for ctrlp
" ===================
let g:ctrlp_max_height = 30
let g:ctrlp_user_command = [
\ '.git', 'cd %s && git ls-files . -co --exclude-standard',
\ 'find %s -type f'
\ ]
"
" Movement
" =========
" bind Ctrl+<movement> keys to move around the windows, instead of using Ctrl+w + <movement>
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
map <Leader>, <esc>:tabprevious<CR>
map <Leader>. <esc>:tabnext<CR>
vnoremap <Leader>s :sort<CR>
" Custom mappings
" ================
vnoremap < <gv " better indentation
vnoremap > >gv " better indentation
map <Leader>a ggVG " select all
" Fixing the copy & paste madness
" ================================
vmap <C-y> y:call system("xclip -i -selection clipboard", getreg("\""))<CR>:call system("xclip -i", getreg("\""))<CR>
nmap <C-v> :call setreg("\"",system("xclip -o -selection clipboard"))<CR>p
imap <C-v> <Esc><C-v>a
" Color scheme
" =============
set t_Co=256
" color mayansmoke
set colorcolumn=80
highlight ColorColumn ctermbg=233
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment