Optimise vi
detection logic and use internal macros and commands as much as possible
#321
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #300 and should also resolve #295.
This pull-request uses:
#{version}
to determine thecurrent tmux version
1Else clauses
forif-shell
2display-message -p
to output the version inbash
3printf
,sort
andhead
to check, if thecurrent tmux version
is higher, than3.0
. The last two commands come from the packagecoreutils
, which has more portability, thanbc
.vi
detection logic uses apseudo substring match
by substitutingg?(view|n?vim?x?)(diff)?$
from#{pane_current_command}
.4Also everything is refactored to use internal macros and commands as much as possible to cause less load and invoking less subshells.
I was not sure about the
vim
-part, but left a comment there with a snippet, which could be used.I adapted everything by logic and tested only certain parts of the plugin.
-Ramon
1
See
CHANGES FROM 2.3 TO 2.4, 20 April 2017
https://github.com/tmux/tmux/blob/master/CHANGES
2
See
CHANGES FROM 1.5 TO 1.6, 23 January 2012
https://github.com/tmux/tmux/blob/master/CHANGES
3
See
CHANGES FROM 1.1 TO 1.2, 10 March 2010
https://github.com/tmux/tmux/blob/master/CHANGES
4
See
CHANGES FROM 2.1 TO 2.2, 10 April 2016
https://github.com/tmux/tmux/blob/master/CHANGES