annotate runtime/ftplugin/lprolog.vim @ 34194:a522c6c0127b v9.1.0047

patch 9.1.0047: issues with temp curwin/buf while cmdwin is open Commit: https://github.com/vim/vim/commit/988f74311c26ea9917e84fbae608de226dba7e5f Author: Sean Dewar <seandewar@users.noreply.github.com> Date: Wed Aug 16 14:17:36 2023 +0100 patch 9.1.0047: issues with temp curwin/buf while cmdwin is open Problem: Things that temporarily change/restore curwin/buf (e.g: win_execute, some autocmds) may break assumptions that curwin/buf is the cmdwin when "cmdwin_type != 0", causing issues. Solution: Expose the cmdwin's real win/buf and check that instead. Also try to ensure these variables are NULL if "cmdwin_type == 0", allowing them to be used directly in most cases without checking cmdwin_type. (Sean Dewar) Alternatively, we could ban win_execute in the cmdwin and audit all places that temporarily change/restore curwin/buf, but I didn't notice any problems arising from allowing this (standard cmdwin restrictions still apply, so things that may actually break the cmdwin are still forbidden). closes: #12819 Signed-off-by: Sean Dewar <seandewar@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 23 Jan 2024 23:00:04 +0100
parents 02939ae3aaca
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim settings file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: LambdaProlog (Teyjus)
659
d6a69271cb9a updated for version 7.0194
vimboss
parents: 20
diff changeset
3 " Maintainer: Markus Mottl <markus.mottl@gmail.com>
d6a69271cb9a updated for version 7.0194
vimboss
parents: 20
diff changeset
4 " URL: http://www.ocaml.info/vim/ftplugin/lprolog.vim
33051
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 659
diff changeset
5 " Last Change: 2023 Aug 28 - added undo_ftplugin (Vim Project)
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 659
diff changeset
6 " 2006 Feb 05
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents: 7
diff changeset
7 " 2001 Sep 16 - fixed 'no_mail_maps'-bug (MM)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents: 7
diff changeset
8 " 2001 Sep 02 - initial release (MM)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 " Only do these settings when not done yet for this buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 if exists("b:did_ftplugin")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " Don't do other file type settings for this buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " Error format
33051
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 659
diff changeset
19 setlocal efm=%+A./%f:%l.%c:\ %m
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " Formatting of comments
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 setlocal formatprg=fmt\ -w75\ -p\\%
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
33051
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 659
diff changeset
24 let b:undo_ftplugin = "setlocal efm< fp<"
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 659
diff changeset
25
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " Add mappings, unless the user didn't want this.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 if !exists("no_plugin_maps") && !exists("no_lprolog_maps")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 " Uncommenting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 if !hasmapto('<Plug>Comment')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 nmap <buffer> <LocalLeader>c <Plug>LUncomOn
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 vmap <buffer> <LocalLeader>c <Plug>BUncomOn
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 nmap <buffer> <LocalLeader>C <Plug>LUncomOff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 vmap <buffer> <LocalLeader>C <Plug>BUncomOff
33051
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 659
diff changeset
34 let b:undo_ftplugin ..=
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 659
diff changeset
35 \ " | silent! execute 'nunmap <buffer> <LocalLeader>c'" ..
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 659
diff changeset
36 \ " | silent! execute 'vunmap <buffer> <LocalLeader>c'" ..
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 659
diff changeset
37 \ " | silent! execute 'nunmap <buffer> <LocalLeader>C'" ..
02939ae3aaca runtime: Set b:undo_ftplugin where missing (#12943)
Christian Brabandt <cb@256bit.org>
parents: 659
diff changeset
38 \ " | silent! execute 'vunmap <buffer> <LocalLeader>C'"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 nnoremap <buffer> <Plug>LUncomOn mz0i/* <ESC>$A */<ESC>`z
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 nnoremap <buffer> <Plug>LUncomOff <ESC>:s/^\/\* \(.*\) \*\//\1/<CR>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 vnoremap <buffer> <Plug>BUncomOn <ESC>:'<,'><CR>`<O<ESC>0i/*<ESC>`>o<ESC>0i*/<ESC>`<
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 vnoremap <buffer> <Plug>BUncomOff <ESC>:'<,'><CR>`<dd`>dd`<
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 endif