split out python and ruby settings
This commit is contained in:
parent
3b5d957036
commit
629084a553
3 changed files with 141 additions and 102 deletions
77
vim-files/vim/ftplugin/python.vim
Normal file
77
vim-files/vim/ftplugin/python.vim
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
|
||||||
|
" Syntastic
|
||||||
|
let g:syntastic_python_checkers = ['pyflakes', 'pep8', 'pep257']
|
||||||
|
let g:syntastic_python_pep8_args='--ignore=E501'
|
||||||
|
|
||||||
|
""" Handy remaps
|
||||||
|
noremap <leader>b Oimport ipdb;ipdb.set_trace()<Esc>
|
||||||
|
|
||||||
|
setlocal ts=4
|
||||||
|
setlocal sw=4
|
||||||
|
setlocal expandtab
|
||||||
|
|
||||||
|
" Don't use tabs in python files
|
||||||
|
autocmd FileType python setlocal expandtab tabstop=4 shiftwidth=4
|
||||||
|
|
||||||
|
function! RunTests(filename, test_path, debug)
|
||||||
|
let tmux_pane = substitute(system("tmux display-message -p '#S'"),'\n','','')
|
||||||
|
let tmux_pane_target = tmux_pane."_testing:1.0"
|
||||||
|
echo tmux_pane_target
|
||||||
|
|
||||||
|
let command = ""
|
||||||
|
if l:tmux_pane == "checkout"
|
||||||
|
" checkout uses py.test (or uh it will)
|
||||||
|
if a:test_path != ' '
|
||||||
|
let pytest_path = substitute(a:test_path, "\\.", "::", "")
|
||||||
|
let full_test_path = a:filename."::".l:pytest_path
|
||||||
|
else
|
||||||
|
let full_test_path = a:filename
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:debug == 1
|
||||||
|
let test_args = "-- -x --ipdb "
|
||||||
|
else
|
||||||
|
let test_args = ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
if l:full_test_path != "::"
|
||||||
|
let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' tox ".test_args.full_test_path." -- --currency USD 2>/dev/null' Enter"
|
||||||
|
else
|
||||||
|
let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' make test 2>/dev/null' Enter"
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" yelp-main uses testify
|
||||||
|
if a:test_path != ' '
|
||||||
|
let full_test_path = a:filename." ".a:test_path
|
||||||
|
else
|
||||||
|
let full_test_path = a:filename
|
||||||
|
endif
|
||||||
|
|
||||||
|
if a:debug == 1
|
||||||
|
let test_args = "-d "
|
||||||
|
else
|
||||||
|
let test_args = ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
if l:full_test_path != " "
|
||||||
|
let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' testify ".test_args.full_test_path."' Enter"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
echo command
|
||||||
|
exec command
|
||||||
|
exec "redraw!"
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! StoreTestPath(filename, lineno)
|
||||||
|
let g:t= a:filename
|
||||||
|
" trololol sorry hbai
|
||||||
|
let g:f = system("python ~hbai/point_at_test/point_at_test.py ".shellescape(a:filename)." ".shellescape(a:lineno))
|
||||||
|
let g:f=substitute(strtrans(g:f),'\^@',' ','g')
|
||||||
|
echo g:t g:f
|
||||||
|
endfun
|
||||||
|
|
||||||
|
map <LEADER>s :call StoreTestPath(expand("%"), line("."))<CR>
|
||||||
|
map <LEADER>T :w\|:call StoreTestPath(expand("%"), line("."))<CR>\|:call RunTests(g:t, g:f, 0)<CR>
|
||||||
|
map <LEADER>t :w\|:call RunTests(g:t, g:f, 0)<CR>
|
||||||
|
map <LEADER>dt :w\|:call RunTests(g:t, g:f, 1)<CR>
|
||||||
|
map <LEADER>m :call RunTests("", "", 0)<CR>
|
||||||
7
vim-files/vim/ftplugin/ruby.vim
Normal file
7
vim-files/vim/ftplugin/ruby.vim
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
Plugin 'tpope/vim-rails'
|
||||||
|
Plugin 'tpope/vim-rake'
|
||||||
|
|
||||||
|
" vim-rspec mappings
|
||||||
|
nnoremap <Leader>t :call RunCurrentSpecFile()<CR>
|
||||||
|
nnoremap <Leader>s :call RunNearestSpec()<CR>
|
||||||
|
nnoremap <Leader>l :call RunLastSpec()<CR>
|
||||||
157
vim-files/vimrc
157
vim-files/vimrc
|
|
@ -10,38 +10,33 @@ call vundle#rc()
|
||||||
"call vundle#rc(path)
|
"call vundle#rc(path)
|
||||||
|
|
||||||
" let Vundle manage Vundle, required
|
" let Vundle manage Vundle, required
|
||||||
Bundle 'gmarik/vundle'
|
Plugin 'gmarik/vundle'
|
||||||
|
|
||||||
|
Plugin 'tpope/vim-endwise'
|
||||||
Bundle 'Lokaltog/vim-easymotion'
|
Plugin 'danro/rename.vim'
|
||||||
Bundle 'tpope/vim-sensible'
|
Plugin 'pbrisbin/vim-mkdir'
|
||||||
Bundle 'tpope/vim-eunuch'
|
Plugin 'Lokaltog/vim-easymotion'
|
||||||
Bundle 'tpope/vim-fugitive'
|
Plugin 'tpope/vim-sensible'
|
||||||
Bundle 'scrooloose/nerdtree'
|
Plugin 'tpope/vim-eunuch'
|
||||||
Bundle 'tomtom/tcomment_vim'
|
Plugin 'tpope/vim-fugitive'
|
||||||
Bundle 'tpope/vim-characterize'
|
Plugin 'scrooloose/nerdtree'
|
||||||
Bundle 'jonathanfilip/vim-lucius'
|
Plugin 'tomtom/tcomment_vim'
|
||||||
Bundle 'nanotech/jellybeans.vim'
|
Plugin 'tpope/vim-characterize'
|
||||||
Bundle 'majutsushi/tagbar'
|
Plugin 'jonathanfilip/vim-lucius'
|
||||||
Bundle 'bling/vim-bufferline'
|
Plugin 'nanotech/jellybeans.vim'
|
||||||
Bundle 'sjl/gundo.vim'
|
Plugin 'majutsushi/tagbar'
|
||||||
Bundle 'SirVer/ultisnips'
|
Plugin 'bling/vim-bufferline'
|
||||||
Bundle 'kien/ctrlp.vim'
|
Plugin 'sjl/gundo.vim'
|
||||||
Bundle 'terryma/vim-multiple-cursors'
|
Plugin 'SirVer/ultisnips'
|
||||||
Bundle 'myusuf3/numbers.vim'
|
Plugin 'kien/ctrlp.vim'
|
||||||
Bundle 'mhinz/vim-signify'
|
Plugin 'terryma/vim-multiple-cursors'
|
||||||
Bundle 'nathanaelkane/vim-indent-guides'
|
Plugin 'myusuf3/numbers.vim'
|
||||||
Bundle 'tpope/vim-surround'
|
Plugin 'mhinz/vim-signify'
|
||||||
Bundle 'tpope/vim-rails'
|
Plugin 'nathanaelkane/vim-indent-guides'
|
||||||
Bundle 'tpope/vim-rake'
|
Plugin 'tpope/vim-surround'
|
||||||
Bundle 'scrooloose/syntastic'
|
Plugin 'scrooloose/syntastic'
|
||||||
Bundle 'Valloric/YouCompleteMe'
|
Plugin 'christoomey/vim-tmux-navigator'
|
||||||
Bundle 'christoomey/vim-tmux-navigator'
|
Plugin 'Valloric/YouCompleteMe'
|
||||||
|
|
||||||
filetype plugin indent on " required
|
|
||||||
""" end vundle
|
|
||||||
|
|
||||||
"""" PLUGIN SETTINGS
|
|
||||||
|
|
||||||
" YouCompleteMe
|
" YouCompleteMe
|
||||||
nnoremap K :YcmCompleter GoTo<CR>
|
nnoremap K :YcmCompleter GoTo<CR>
|
||||||
|
|
@ -49,9 +44,10 @@ nnoremap ˚ :YcmCompleter GoToDeclaration<CR>
|
||||||
let g:ycm_goto_buffer_command = 'horizontal-split'
|
let g:ycm_goto_buffer_command = 'horizontal-split'
|
||||||
let g:ycm_autoclose_preview_window_after_insertion = 1
|
let g:ycm_autoclose_preview_window_after_insertion = 1
|
||||||
|
|
||||||
" Syntastic
|
filetype plugin indent on " required
|
||||||
let g:syntastic_python_checkers = ['pyflakes', 'pep8', 'pep257']
|
""" end vundle
|
||||||
let g:syntastic_python_pep8_args='--ignore=E501'
|
|
||||||
|
"""" PLUGIN SETTINGS
|
||||||
|
|
||||||
" Powerline!
|
" Powerline!
|
||||||
set rtp+=~/dotfiles/misc-files/powerline/powerline/bindings/vim
|
set rtp+=~/dotfiles/misc-files/powerline/powerline/bindings/vim
|
||||||
|
|
@ -63,6 +59,17 @@ map n <Plug>(easymotion-next)
|
||||||
map N <Plug>(easymotion-prev)
|
map N <Plug>(easymotion-prev)
|
||||||
let g:EasyMotion_landing_highlight = 1
|
let g:EasyMotion_landing_highlight = 1
|
||||||
""" CtrlP
|
""" CtrlP
|
||||||
|
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
|
||||||
|
if executable('ag')
|
||||||
|
" Use Ag over Grep
|
||||||
|
set grepprg=ag\ --nogroup\ --nocolor
|
||||||
|
|
||||||
|
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
|
||||||
|
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
|
||||||
|
|
||||||
|
" ag is fast enough that CtrlP doesn't need to cache
|
||||||
|
let g:ctrlp_use_caching = 0
|
||||||
|
endif
|
||||||
|
|
||||||
""" Gundo
|
""" Gundo
|
||||||
map <leader>u :GundoToggle<CR>
|
map <leader>u :GundoToggle<CR>
|
||||||
|
|
@ -116,7 +123,13 @@ set matchpairs+=<:>
|
||||||
|
|
||||||
set list
|
set list
|
||||||
set listchars=tab:>-,trail:-,extends:>,precedes:<,nbsp:+,eol:$
|
set listchars=tab:>-,trail:-,extends:>,precedes:<,nbsp:+,eol:$
|
||||||
set ts=4
|
set ts=2
|
||||||
|
set shiftwidth=2
|
||||||
|
set expandtab
|
||||||
|
|
||||||
|
" Open new split panes to right and bottom, which feels more natural
|
||||||
|
set splitbelow
|
||||||
|
set splitright
|
||||||
|
|
||||||
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
|
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
|
||||||
set clipboard=unnamed
|
set clipboard=unnamed
|
||||||
|
|
@ -157,13 +170,16 @@ endfunction
|
||||||
""" Handy remaps
|
""" Handy remaps
|
||||||
noremap ; :
|
noremap ; :
|
||||||
inoremap jj <Esc>
|
inoremap jj <Esc>
|
||||||
nnoremap <silent> <F8> :TlistToggle<CR>
|
|
||||||
map <silent> <leader>V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
|
map <silent> <leader>V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
|
||||||
"nnoremap <leader>d :NERDTreeToggle<cr>
|
"nnoremap <leader>d :NERDTreeToggle<cr>
|
||||||
map \q :q<CR>
|
map \q :q<CR>
|
||||||
map \w :w<CR>
|
map \w :w<CR>
|
||||||
noremap Q <nop>
|
noremap Q <nop>
|
||||||
noremap <leader>b Oimport ipdb;ipdb.set_trace()<Esc>
|
" Quicker window movement
|
||||||
|
nnoremap <C-j> <C-w>j
|
||||||
|
nnoremap <C-k> <C-w>k
|
||||||
|
nnoremap <C-h> <C-w>h
|
||||||
|
nnoremap <C-l> <C-w>l
|
||||||
|
|
||||||
" Don’t reset cursor to start of line when moving around.
|
" Don’t reset cursor to start of line when moving around.
|
||||||
set nostartofline
|
set nostartofline
|
||||||
|
|
@ -175,9 +191,6 @@ set mouse=a
|
||||||
|
|
||||||
""" smart path
|
""" smart path
|
||||||
set path=.,,**
|
set path=.,,**
|
||||||
"
|
|
||||||
" Don't use tabs in python files
|
|
||||||
autocmd FileType python setlocal expandtab tabstop=4 shiftwidth=4
|
|
||||||
|
|
||||||
command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>)
|
command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>)
|
||||||
function! s:RunShellCommand(cmdline)
|
function! s:RunShellCommand(cmdline)
|
||||||
|
|
@ -244,65 +257,7 @@ function! MoveToNextTab()
|
||||||
exe "b".l:cur_buf
|
exe "b".l:cur_buf
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! RunTests(filename, test_path, debug)
|
" Local overrides?
|
||||||
let tmux_pane = substitute(system("tmux display-message -p '#S'"),'\n','','')
|
if filereadable($HOME . "/.vimrc.local")
|
||||||
let tmux_pane_target = tmux_pane."_testing:1.0"
|
source ~/.vimrc.local
|
||||||
echo tmux_pane_target
|
|
||||||
|
|
||||||
let command = ""
|
|
||||||
if l:tmux_pane == "checkout"
|
|
||||||
" checkout uses py.test (or uh it will)
|
|
||||||
if a:test_path != ' '
|
|
||||||
let pytest_path = substitute(a:test_path, "\\.", "::", "")
|
|
||||||
let full_test_path = a:filename."::".l:pytest_path
|
|
||||||
else
|
|
||||||
let full_test_path = a:filename
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:debug == 1
|
|
||||||
let test_args = "-- -x --ipdb "
|
|
||||||
else
|
|
||||||
let test_args = ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
if l:full_test_path != "::"
|
|
||||||
let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' tox ".test_args.full_test_path." -- --currency USD 2>/dev/null' Enter"
|
|
||||||
else
|
|
||||||
let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' make test 2>/dev/null' Enter"
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
" yelp-main uses testify
|
|
||||||
if a:test_path != ' '
|
|
||||||
let full_test_path = a:filename." ".a:test_path
|
|
||||||
else
|
|
||||||
let full_test_path = a:filename
|
|
||||||
endif
|
|
||||||
|
|
||||||
if a:debug == 1
|
|
||||||
let test_args = "-d "
|
|
||||||
else
|
|
||||||
let test_args = ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
if l:full_test_path != " "
|
|
||||||
let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' testify ".test_args.full_test_path."' Enter"
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
echo command
|
|
||||||
exec command
|
|
||||||
exec "redraw!"
|
|
||||||
endfun
|
|
||||||
|
|
||||||
function! StoreTestPath(filename, lineno)
|
|
||||||
let g:t= a:filename
|
|
||||||
" trololol sorry hbai
|
|
||||||
let g:f = system("python ~hbai/point_at_test/point_at_test.py ".shellescape(a:filename)." ".shellescape(a:lineno))
|
|
||||||
let g:f=substitute(strtrans(g:f),'\^@',' ','g')
|
|
||||||
echo g:t g:f
|
|
||||||
endfun
|
|
||||||
|
|
||||||
map <LEADER>s :call StoreTestPath(expand("%"), line("."))<CR>
|
|
||||||
map <LEADER>T :w\|:call StoreTestPath(expand("%"), line("."))<CR>\|:call RunTests(g:t, g:f, 0)<CR>
|
|
||||||
map <LEADER>t :w\|:call RunTests(g:t, g:f, 0)<CR>
|
|
||||||
map <LEADER>dt :w\|:call RunTests(g:t, g:f, 1)<CR>
|
|
||||||
map <LEADER>m :call RunTests("", "", 0)<CR>
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue