21 lines
469 B
VimL
21 lines
469 B
VimL
|
" A small plugin to fold if err nil statements that do nothing except for
|
||
|
" propagating errors
|
||
|
" License: Unlicense
|
||
|
|
||
|
if exists('g:loaded_gofoldiferrnil') | finish | endif " prevent loading file twice
|
||
|
|
||
|
if !has('nvim-0.5')
|
||
|
echoerr 'You need neovim 0.5 or newer to run this plugin'
|
||
|
finish
|
||
|
endif
|
||
|
|
||
|
let s:save_cpo = &cpo
|
||
|
set cpo&vim
|
||
|
|
||
|
command! GoFoldIfErr lua require('fold_if_err_nil').foldIfErrNills()
|
||
|
|
||
|
let &cpo = s:save_cpo
|
||
|
unlet s:save_cpo
|
||
|
|
||
|
let g:loaded_whid = 1
|