Skip to content

Commit

Permalink
autocommands fix
Browse files Browse the repository at this point in the history
  • Loading branch information
noscript committed Aug 18, 2023
1 parent 7cec3d8 commit e99c1fa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 0 additions & 2 deletions autoload/bazel.vim
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ export def DetectWorkspace()
nnoremap <silent> gb <Plug>(bazel-goto-build)
nnoremap <silent> b<C-G> <Plug>(bazel-print-rel)
nnoremap <silent> <leader>p <Plug>(bazel-print-label)
autocmd FileType bzl nnoremap <silent> <buffer> gd <Plug>(bazel-definition)
autocmd FileType bzl nnoremap <silent> <buffer> gr <Plug>(bazel-references)
endif

set errorformat^=%t%*[^:]:\ %f:%l:%c:\ %m # recognize error type in "<TYPE>: <file><lnum>:<col>: <message>" form
Expand Down
13 changes: 13 additions & 0 deletions ftplugin/bzl.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
vim9script

if exists("b:did_ftplugin")
finish
endif
b:did_ftplugin = 1

bazel#DetectWorkspace()

if !exists('g:bazel_no_default_mappings') || !g:bazel_no_default_mappings
nnoremap <silent> <buffer> gd <Plug>(bazel-definition)
nnoremap <silent> <buffer> gr <Plug>(bazel-references)
endif
3 changes: 1 addition & 2 deletions plugin/bazel.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ import autoload 'bazel.vim'

augroup Bazel
autocmd!
autocmd FileType bzl if expand('%:t') == 'BUILD' | bazel#DetectWorkspace() | endif
autocmd DirChanged * bazel#DetectWorkspace()
autocmd VimEnter,BufEnter * bazel#DetectWorkspace()
augroup END

0 comments on commit e99c1fa

Please sign in to comment.