Skip to content

Instantly share code, notes, and snippets.

@hassek
Last active December 25, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hassek/6887239 to your computer and use it in GitHub Desktop.
Save hassek/6887239 to your computer and use it in GitHub Desktop.
set nobackup
set nowritebackup
"make the yank use the system clipboard
"set clipboard=unnamed
set tabstop=2 softtabstop=2 shiftwidth=2 textwidth=0
au BufRead,BufNewFile *.html set filetype=htmldjango
set tags+=./tags;$HOME
let NERD_htmldjango_alt_style=1
let NERD_django_alt_style=1
set nolist
set nowrap
set synmaxcol=220
colorscheme BlackSea
let g:syntastic_python_flake8_args='--ignore=E124,E226,E24,E128,E127,E123,E126 --max-line-length=119'
"let g:syntastic_python_checker_args='--ignore=E501,W391'
"Mappings de Tomas
map <C-z> :normal Iimport ipdb; ipdb.set_trace()<Esc>
imap <C-z> import ipdb; ipdb.set_trace()
map <C-s> :normal Ifrom celery.contrib import rdb; rdb.set_trace()<Esc>
imap <C-s> from celery.contrib import rdb; rdb.set_trace()
" test current function
" @c ==> ?</class/> veyp
nnoremap <S-t> O./manage.py test %dd<C-r>"
inoremap jk <esc>
map \z :normal I{% load dashboard_tpl_tags %} {{CHANGEME\|pdb}}<Esc>
imap \z {% load dashboard_tpl_tags %} {{CHANGEME\|pdb}}
map \s :normal Idebugger;<Esc>
imap \s debugger;
map <C-j> :lne<CR>
map <C-k> :lp<CR>
map <C-c> :sp $VIRTUAL_ENV/lib/python2.7/site-packages/<CR>
map \d :vertical diffsplit
" Toggle line numbers and fold column for easy copying:
nnoremap <F3> :GundoShow<CR>
nnoremap <F4> :set nospell!<CR>
nnoremap <F6> :!ctags -R --python-kinds=-i * <CR>
nnoremap <F7> :!ctags -R --python-kinds=-i -a $VIRTUAL_ENV/lib/python2.7/site-packages/django/*<CR>
nnoremap \c :e scp://root@staging.onereceipt.com//home/web/OneReceipt/onereceipt/<CR>
nnoremap \x :e scp://root@wizzy3.onereceipt.com//home/web/OneReceipt/onereceipt/<CR>
map <C-l> \c<space><CR>
imap <C-l> \c<space><CR>i
map <leader><leader> :ZoomWin <CR>
let $JS_CMD='node'
let g:gist_open_browser_after_post = 1
" Don't replace content when pasting
xnoremap p pgvy
" ---------------Functions--------------- "
function! ToggleQuickFix()
if exists("g:qwindow")
lclose
unlet g:qwindow
else
try
lopen 10
let g:qwindow = 1
catch
echo "No Errors found!"
endtry
endif
endfunction
"Runs the current test your cursor is at the moment
python << endpython
def run_current_test():
import vim
command = "!./manage.py test %"
cb = vim.current.buffer
cw = vim.current.window
original_position = vim.current.window.cursor
vim.command("?\<def\>")
def_name = cb[vim.current.window.cursor[0] - 1].split()[1].split('(')[0]
vim.command("?\<class\>")
class_name = cb[vim.current.window.cursor[0] - 1].split()[1].split('(')[0]
command += ":%s.%s" % (class_name, def_name)
print command
cw.cursor = original_position
vim.command(command)
endpython
nmap <S-t> :py run_current_test()<CR>
nmap <script> <silent> <F2> :call ToggleQuickFix()<CR>
set guifont=Menlo:h14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment