Mercurial > vim
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 |
rev | line source |
---|---|
7 | 1 " Vim settings file |
2 " Language: LambdaProlog (Teyjus) | |
659 | 3 " Maintainer: Markus Mottl <markus.mottl@gmail.com> |
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 | 7 " 2001 Sep 16 - fixed 'no_mail_maps'-bug (MM) |
8 " 2001 Sep 02 - initial release (MM) | |
7 | 9 |
10 " Only do these settings when not done yet for this buffer | |
11 if exists("b:did_ftplugin") | |
12 finish | |
13 endif | |
14 | |
15 " Don't do other file type settings for this buffer | |
16 let b:did_ftplugin = 1 | |
17 | |
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 | 20 |
21 " Formatting of comments | |
22 setlocal formatprg=fmt\ -w75\ -p\\% | |
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 | 26 " Add mappings, unless the user didn't want this. |
27 if !exists("no_plugin_maps") && !exists("no_lprolog_maps") | |
28 " Uncommenting | |
29 if !hasmapto('<Plug>Comment') | |
30 nmap <buffer> <LocalLeader>c <Plug>LUncomOn | |
31 vmap <buffer> <LocalLeader>c <Plug>BUncomOn | |
32 nmap <buffer> <LocalLeader>C <Plug>LUncomOff | |
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 | 39 endif |
40 | |
41 nnoremap <buffer> <Plug>LUncomOn mz0i/* <ESC>$A */<ESC>`z | |
42 nnoremap <buffer> <Plug>LUncomOff <ESC>:s/^\/\* \(.*\) \*\//\1/<CR> | |
43 vnoremap <buffer> <Plug>BUncomOn <ESC>:'<,'><CR>`<O<ESC>0i/*<ESC>`>o<ESC>0i*/<ESC>`< | |
44 vnoremap <buffer> <Plug>BUncomOff <ESC>:'<,'><CR>`<dd`>dd`< | |
45 endif |