Skip to content

Commit 511ba08

Browse files
Move all filetype specific includes to ftplugin (#208)
possibly more performant per https://stackoverflow.com/questions/7863804/autocmd-filetype-vs-ftplugin
1 parent 36f21ad commit 511ba08

File tree

8 files changed

+34
-40
lines changed

8 files changed

+34
-40
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

ftplugin/python.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ if v:shell_error == 0
44
let g:ale_fixers['python'] = ['black']
55
let g:ale_python_black_auto_pipenv = 1
66
endif
7+
map <silent> <LocalLeader>rb :wa<CR>:TestFile<CR>
8+
map <silent> <LocalLeader>rf :wa<CR>:TestNearest<CR>
9+
map <silent> <LocalLeader>rl :wa<CR>:TestLast<CR>

ftplugin/ruby.vim

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,34 @@ if filereadable(expand(".rubocop.yml"))
22
let g:ale_linters['ruby'] = ['rubocop']
33
let g:ale_fixers['ruby'] = ['rubocop']
44
endif
5+
function! TestContext()
6+
wall
7+
let [_, lnum, cnum, _] = getpos('.')
8+
RubyBlockSpecParentContext
9+
TestNearest
10+
call cursor(lnum, cnum)
11+
endfunction
12+
13+
command! TestContext :call TestContext()
14+
15+
map <silent> <LocalLeader>rc :TestContext<CR>
16+
map <silent> <LocalLeader>rb :wa<CR>:TestFile<CR>
17+
map <silent> <LocalLeader>rf :wa<CR>:TestNearest<CR>
18+
map <silent> <LocalLeader>rl :wa<CR>:TestLast<CR>
19+
map <silent> <LocalLeader>rx :wa<CR>:VimuxCloseRunner<CR>
20+
map <silent> <LocalLeader>ri :wa<CR>:VimuxInspectRunner<CR>
21+
map <silent> <LocalLeader>rs :!ruby -c %<CR>
22+
map <silent> <LocalLeader>AA :A<CR>
23+
map <silent> <LocalLeader>AV :AV<CR>
24+
map <silent> <LocalLeader>AS :AS<CR>
25+
26+
" Restore vim-diff shortcuts
27+
silent! unmap ]c
28+
map <silent> ]C :RubyBlockSpecParentContext<CR>
29+
30+
map <LocalLeader>rd Orequire "pry"; binding.pry<ESC>
31+
32+
" Search for tag
33+
nmap <silent> <LocalLeader>] :Tags '<C-R><C-W> <CR>
34+
35+
setlocal isk+=?

python_mappings.vim

Lines changed: 0 additions & 3 deletions
This file was deleted.

ruby_mappings.vim

Lines changed: 0 additions & 31 deletions
This file was deleted.

vimrc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,6 @@ endif
8888

8989
autocmd FileType tex setlocal textwidth=78
9090

91-
autocmd FileType ruby runtime ruby_mappings.vim
92-
autocmd FileType cs runtime dotnet_mappings.vim
93-
autocmd FileType javascript runtime javascript_mappings.vim
94-
autocmd FileType python runtime python_mappings.vim
95-
autocmd FileType java runtime java_mappings.vim
96-
9791
" wstrip plugin
9892
" don't highlight trailing whitespace
9993
let g:wstrip_highlight = 0

0 commit comments

Comments
 (0)