RFC: keepalt/keepjumps
Nobody has claimed this yet.
- Dominant language
- Vim Script
- Stars
- 587
- Forks
- 64
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 1
Description
なんか僕が勘違いしてたせいで余分な keepalt と keepjumps が入ってる気がします。
*:keepalt* *:keepa*
:keepalt {cmd} Execute {cmd} while keeping the current alternate file
name. Note that commands invoked indirectly (e.g.,
with a function) may still set the alternate file
name.
All file names are remembered in the buffer list. When you enter a file name,
for editing (e.g., with ":e filename") or writing (e.g., with ":w filename"),
the file name is added to the list. You can use the buffer list to remember
which files you edited and to quickly switch from one file to another (e.g.,
to copy text) with the |CTRL-^| command. First type the number of the file
and then hit CTRL-^.
---
A "jump" is one of the following commands: "'", "`", "G", "/", "?", "n",
"N", "%", "(", ")", "[[", "]]", "{", "}", ":s", ":tag", "L", "M", "H" and
the commands that start editing a new file. If you make the cursor "jump"
with one of these commands, the position of the cursor before the jump is
remembered. You can return to that position with the "''" and "``" command,
unless the line containing that position was changed or deleted.
...
When the |:keepjumps| command modifier is used, jumps are not stored in the
jumplist. Jumps are also not stored in other cases, e.g., in a |:global|
command. You can explicitly add a jump by setting the ' mark with "m'". Note
...
*:keepj* *:keepjumps*
:keepj[umps] {command}
Moving around in {command} does not change the |''|,
|'.| and |'^| marks, the |jumplist| or the
|changelist|.
Useful when making a change or inserting text
automatically and the user doesn't want to go to this
position. E.g., when updating a "Last change"
timestamp in the first line: >
:let lnum = line(".")
:keepjumps normal gg
:call SetLastChange()
:keepjumps exe "normal " . lnum . "G"
<
Note that ":keepjumps" must be used for every command.
When invoking a function the commands in that function
can still change the jumplist. Also, for
":keepjumps exe 'command '" the "command" won't keep
jumps. Instead use: ":exe 'keepjumps command'"
上記的には
:e {filename},:w {filename}および準ずる コマンド 実行時に alternative file を変えたくない場合はkeepalt必が要',G, などのカーソル位置を大きく動かすコマンドにてjumplistを変更したくない場合はkeepjumpsが必要setpos()を呼んでもjumplistは更新されない(たぶん'みたいなコマンド実行時だけjumplistが更新されるということ?)
となるので、以下に指定している(僕が指定した) keepjumps や keepalt はそもそも指定されている意味がない気がします。
https://github.com/vim-jp/vital.vim/blob/master/autoload/vital/__vital__/Vim/Buffer.vim#L117
https://github.com/vim-jp/vital.vim/blob/master/autoload/vital/__vital__/Vim/Buffer.vim#L140
https://github.com/vim-jp/vital.vim/blob/master/autoload/vital/__vital__/Vim/Buffer.vim#L145
あっても問題はないかと思いますが、不要なものがあると参考にした時に困るので問題なさそうなら消そうかと思います。
ただ、ちょっとこの辺自信ないのでご意見お願いいたします。
追記
keepjumps %delete _ が正解でした https://github.com/lambdalisue/gina.vim/issues/39
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with autoload/vital/vital/Vim/Buffer.vim at the linked locations around lines 117, 140, and 145. Review how the keepjumps and keepalt modifiers are used, then verify whether each is redundant based on the issue’s Vim behavior notes. Done means the unnecessary modifiers are removed or the specific uses are justified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vim
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100