aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-13 08:56:58 +0800
committerGitHub <noreply@github.com>2024-07-13 08:56:58 +0800
commitb1aa8f5eb8a5407e869335e9987b73f8515c37e5 (patch)
tree11d8e4909a8b191fbe627354fe68972102d6e467 /runtime
parent10256bb760fcab0dc25f7eb5b0b45966cb771939 (diff)
downloadrneovim-b1aa8f5eb8a5407e869335e9987b73f8515c37e5.tar.gz
rneovim-b1aa8f5eb8a5407e869335e9987b73f8515c37e5.tar.bz2
rneovim-b1aa8f5eb8a5407e869335e9987b73f8515c37e5.zip
vim-patch:9.1.0572: cannot specify tab page closing behaviour (#29682)
Problem: cannot specify tab page closing behaviour (Gianluca Pacchiella) Solution: Add the 'tabclose' option (LemonBoy). fixes: vim/vim#5967 closes: vim/vim#15204 https://github.com/vim/vim/commit/5247b0b92e191a046b034171a3b34031e317735f Co-authored-by: LemonBoy <thatlemon@gmail.com>
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/news.txt1
-rw-r--r--runtime/doc/options.txt13
-rw-r--r--runtime/doc/quickref.txt1
-rw-r--r--runtime/doc/tabpage.txt3
-rw-r--r--runtime/lua/vim/_meta/options.lua16
-rw-r--r--runtime/optwin.vim4
6 files changed, 36 insertions, 2 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 604515a808..39b3a506ca 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -141,6 +141,7 @@ LUA
OPTIONS
• 'completeopt' flag "fuzzy" enables |fuzzy-matching| during |ins-completion|.
+• 'tabclose' controls which tab page to focus when closing a tab page.
PERFORMANCE
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 4bb589fb2c..caa6649b17 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -6343,6 +6343,19 @@ A jump table for the options with a short description can be found at |Q_op|.
'S' flag in 'cpoptions'.
Only normal file name characters can be used, `/\*?[|<>` are illegal.
+ *'tabclose'* *'tcl'*
+'tabclose' 'tcl' string (default "")
+ global
+ This option controls the behavior when closing tab pages (e.g., using
+ |:tabclose|). When empty Vim goes to the next (right) tab page.
+
+ Possible values (comma-separated list):
+ left If included, go to the previous tab page instead of
+ the next one.
+ uselast If included, go to the previously used tab page if
+ possible. This option takes precedence over the
+ others.
+
*'tabline'* *'tal'*
'tabline' 'tal' string (default "")
global
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index 5eea9baa20..d77750b485 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -886,6 +886,7 @@ Short explanation of each option: *option-list*
'switchbuf' 'swb' sets behavior when switching to another buffer
'synmaxcol' 'smc' maximum column to find syntax items
'syntax' 'syn' syntax to be loaded for current buffer
+'tabclose' 'tcl' which tab page to focus when closing a tab
'tabline' 'tal' custom format for the console tab pages line
'tabpagemax' 'tpm' maximum number of tab pages for |-p| and "tab all"
'tabstop' 'ts' number of spaces that <Tab> in file uses
diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt
index 2f50e31ee5..7bfa36e8ab 100644
--- a/runtime/doc/tabpage.txt
+++ b/runtime/doc/tabpage.txt
@@ -135,7 +135,8 @@ something else.
:tabclose $ " close the last tab page
:tabclose # " close the last accessed tab page
-When a tab is closed the next tab page will become the current one.
+When a tab is closed the next tab page will become the current one. This
+behaviour can be customized using the 'tabclose' option.
*:tabo* *:tabonly*
:tabo[nly][!] Close all other tab pages.
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
index 40c12d94fd..332dbda6e9 100644
--- a/runtime/lua/vim/_meta/options.lua
+++ b/runtime/lua/vim/_meta/options.lua
@@ -6837,6 +6837,22 @@ vim.o.syn = vim.o.syntax
vim.bo.syntax = vim.o.syntax
vim.bo.syn = vim.bo.syntax
+--- This option controls the behavior when closing tab pages (e.g., using
+--- `:tabclose`). When empty Vim goes to the next (right) tab page.
+---
+--- Possible values (comma-separated list):
+--- left If included, go to the previous tab page instead of
+--- the next one.
+--- uselast If included, go to the previously used tab page if
+--- possible. This option takes precedence over the
+--- others.
+---
+--- @type string
+vim.o.tabclose = ""
+vim.o.tcl = vim.o.tabclose
+vim.go.tabclose = vim.o.tabclose
+vim.go.tcl = vim.go.tabclose
+
--- When non-empty, this option determines the content of the tab pages
--- line at the top of the Vim window. When empty Vim will use a default
--- tab pages line. See `setting-tabline` for more info.
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 3b874f4cda..f168218c91 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
-" Last Change: 2024 Jun 05
+" Last Change: 2024 Jul 12
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" If there already is an option window, jump to that one.
@@ -507,6 +507,8 @@ endif
call <SID>Header(gettext("multiple tab pages"))
call <SID>AddOption("showtabline", gettext("0, 1 or 2; when to use a tab pages line"))
call append("$", " \tset stal=" . &stal)
+call <SID>AddOption("tabclose", gettext("behaviour when closing tab pages: left, uselast or empty"))
+call append("$", " \tset tcl=" . &tcl)
call <SID>AddOption("tabpagemax", gettext("maximum number of tab pages to open for -p and \"tab all\""))
call append("$", " \tset tpm=" . &tpm)
call <SID>AddOption("tabline", gettext("custom tab pages line"))