Skip to content

Commit

Permalink
feat: Add silent! to every execute()
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Dec 27, 2019
1 parent ed368a1 commit c1a526f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
8 changes: 4 additions & 4 deletions autoload/doge.vim
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ function! doge#activate() abort
\ g:doge_mapping_comment_jump_backward,
\ ]
for l:mode in g:doge_comment_jump_modes
execute(printf('%smap <nowait> <silent> <buffer> %s <Plug>(doge-comment-jump-forward)', l:mode, l:f))
execute(printf('%smap <nowait> <silent> <buffer> %s <Plug>(doge-comment-jump-backward)', l:mode, l:b))
call execute(printf('%smap <nowait> <silent> <buffer> %s <Plug>(doge-comment-jump-forward)', l:mode, l:f), 'silent!')
call execute(printf('%smap <nowait> <silent> <buffer> %s <Plug>(doge-comment-jump-backward)', l:mode, l:b), 'silent!')
endfor
endfunction

Expand Down Expand Up @@ -96,8 +96,8 @@ function! doge#deactivate() abort
\ g:doge_mapping_comment_jump_backward,
\ ]
for l:mode in g:doge_comment_jump_modes
execute(printf('%sunmap <buffer> %s', l:mode, l:f))
execute(printf('%sunmap <buffer> %s', l:mode, l:b))
call execute(printf('%sunmap <buffer> %s', l:mode, l:f), 'silent!')
call execute(printf('%sunmap <buffer> %s', l:mode, l:b), 'silent!')
endfor
endfunction

Expand Down
2 changes: 1 addition & 1 deletion autoload/doge/helpers.vim
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function! doge#helpers#count(word, ...) abort
endif

try
let l:cnt = execute(l:range . 's/' . a:word . '//gn')
let l:cnt = execute(l:range . 's/' . a:word . '//gn', 'silent!')
catch /^Vim\%((\a\+)\)\=:E486/
return 0
endtry
Expand Down
11 changes: 6 additions & 5 deletions autoload/doge/pattern.vim
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function! doge#pattern#generate(pattern) abort
" Go to the top of the comment and select the first TODO.
exe l:comment_lnum_insert_position + 1
call search(s:comment_placeholder, 'W')
call execute("normal! gno\<C-g>")
call execute("normal! gno\<C-g>", 'silent!')
endif
endif
endif
Expand Down Expand Up @@ -234,14 +234,14 @@ function! doge#pattern#custom(name) abort
endif
if filereadable(l:path)
let l:cmd = &showtabline ? 'tabedit' : 'split'
call execute(l:cmd . fnameescape(l:path))
call execute(l:cmd . fnameescape(l:path), 'silent!')
elseif bufexists(l:path)
call execute('drop ' . fnameescape(l:path))
call execute('drop ' . fnameescape(l:path), 'silent!')
else
execute(&showtabline ? 'tabnew' : 'new')
call execute(&showtabline ? 'tabnew' : 'new', 'silent!')
setfiletype vim
if !empty(l:path)
execute('file ' . fnameescape(l:path))
call execute('file ' . fnameescape(l:path), 'silent!')
endif
endif

Expand Down Expand Up @@ -290,6 +290,7 @@ function! doge#pattern#custom(name) abort
call setreg('"', l:doc)
1
normal! ""P'[=']Gdipgg
call execute('w', 'silent!')
endfunction

let &cpoptions = s:save_cpo
Expand Down
4 changes: 2 additions & 2 deletions autoload/doge/python.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ function! doge#python#file(path, args) abort
echoerr 'Vim is not compiled with Python3 or Python.'
endif

execute(l:python . ' ' . 'sys.argv = [' . join(map(copy(a:args), { key, value -> '"' . value . '"' }), ', ') . ']')
return doge#helpers#trim(execute(l:pyfile . ' ' . a:path))
call execute(l:python . ' ' . 'sys.argv = [' . join(map(copy(a:args), { key, value -> '"' . value . '"' }), ', ') . ']', 'silent!')
return doge#helpers#trim(execute(l:pyfile . ' ' . a:path, 'silent!'))
endfunction

let &cpoptions = s:save_cpo
Expand Down
10 changes: 5 additions & 5 deletions plugin/doge.vim
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,16 @@ endif

nnoremap <Plug>(doge-generate) :<C-u>call doge#generate(v:count)<CR>
for s:mode in g:doge_comment_jump_modes
execute(printf('%snoremap <expr> <Plug>(doge-comment-jump-forward) doge#comment#jump("forward")', s:mode))
execute(printf('%snoremap <expr> <Plug>(doge-comment-jump-backward) doge#comment#jump("backward")', s:mode))
call execute(printf('%snoremap <expr> <Plug>(doge-comment-jump-forward) doge#comment#jump("forward")', s:mode), 'silent!')
call execute(printf('%snoremap <expr> <Plug>(doge-comment-jump-backward) doge#comment#jump("backward")', s:mode), 'silent!')
endfor

if g:doge_enable_mappings == v:true
execute(printf('nmap <silent> %s <Plug>(doge-generate)', g:doge_mapping))
call execute(printf('nmap <silent> %s <Plug>(doge-generate)', g:doge_mapping), 'silent!')
if g:doge_buffer_mappings == v:false
for s:mode in g:doge_comment_jump_modes
execute(printf('%smap <silent> %s <Plug>(doge-comment-jump-forward)', s:mode, g:doge_mapping_comment_jump_forward))
execute(printf('%smap <silent> %s <Plug>(doge-comment-jump-backward)', s:mode, g:doge_mapping_comment_jump_backward))
call execute(printf('%smap <silent> %s <Plug>(doge-comment-jump-forward)', s:mode, g:doge_mapping_comment_jump_forward), 'silent!')
call execute(printf('%smap <silent> %s <Plug>(doge-comment-jump-backward)', s:mode, g:doge_mapping_comment_jump_backward), 'silent!')
endfor
endif
endif
Expand Down

0 comments on commit c1a526f

Please sign in to comment.