Skip to content

Commit a853610

Browse files
committed
Restore &cpo even when finishing early
If a script calls `finish`, the restoration of `&cpo`, which is at the end of the script, never gets called. As a follow-up to #2055, this change moves the place where `&cpo` is preserved until after the places where `finish` is called. I believe this is safe, since those places are near the beginning of their respective scripts, and there's nothing earlier that's dependent on the default setting of `&cpo`.
1 parent 2e1eb6f commit a853610

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

ftplugin/go/tagbar.vim

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
" don't spam the user when Vim is started in Vi compatibility mode
2-
let s:cpo_save = &cpo
3-
set cpo&vim
4-
51
" Check if tagbar is installed under plugins or is directly under rtp
62
" this covers pathogen + Vundle/Bundle
73
"
@@ -13,6 +9,10 @@ elseif globpath(&rtp, 'plugin/tagbar.vim') == ""
139
finish
1410
endif
1511

12+
" don't spam the user when Vim is started in Vi compatibility mode
13+
let s:cpo_save = &cpo
14+
set cpo&vim
15+
1616
if !exists("g:go_gotags_bin")
1717
let g:go_gotags_bin = "gotags"
1818
endif

indent/go.vim

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ if exists("b:did_indent")
1313
endif
1414
let b:did_indent = 1
1515

16-
" don't spam the user when Vim is started in Vi compatibility mode
17-
let s:cpo_save = &cpo
18-
set cpo&vim
19-
2016
" C indentation is too far off useful, mainly due to Go's := operator.
2117
" Let's just define our own.
2218
setlocal nolisp
@@ -28,6 +24,10 @@ if exists("*GoIndent")
2824
finish
2925
endif
3026

27+
" don't spam the user when Vim is started in Vi compatibility mode
28+
let s:cpo_save = &cpo
29+
set cpo&vim
30+
3131
function! GoIndent(lnum) abort
3232
let prevlnum = prevnonblank(a:lnum-1)
3333
if prevlnum == 0

indent/gohtmltmpl.vim

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ if exists("b:did_indent")
22
finish
33
endif
44

5-
" don't spam the user when Vim is started in Vi compatibility mode
6-
let s:cpo_save = &cpo
7-
set cpo&vim
8-
95
runtime! indent/html.vim
106

117
" Indent Golang HTML templates
@@ -17,6 +13,10 @@ if exists("*GetGoHTMLTmplIndent")
1713
finish
1814
endif
1915

16+
" don't spam the user when Vim is started in Vi compatibility mode
17+
let s:cpo_save = &cpo
18+
set cpo&vim
19+
2020
function! GetGoHTMLTmplIndent(lnum)
2121
" Get HTML indent
2222
if exists('*HtmlIndent')

0 commit comments

Comments
 (0)