mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-18 12:33:38 +08:00
11a60c8374
I hate doing this but I am tired of touching a fish script as part of some change and having `make style` radically change it. Which makes editing fish scripts more painful than it needs to be. It is time to do a wholesale reformatting of these scripts to conform to the documented style as implemented by the `fish_indent` program.
19 lines
869 B
Fish
19 lines
869 B
Fish
# This is meant to be bound to key sequences such as \e#. It provides a simple way to quickly
|
|
# comment/uncomment the current command. This is something introduced by the Korn shell (ksh) in
|
|
# 1993. It allows you to capture a command in the shell history without executing it. Then
|
|
# retrieving the command from the shell history and removing the comment chars.
|
|
#
|
|
# This deliberately does not execute the command when removing the comment characters to give you an
|
|
# opportunity to modify the command.
|
|
|
|
function __fish_toggle_comment_commandline --description 'Comment/uncomment the current command'
|
|
set -l cmdlines (commandline -b)
|
|
if test "$cmdlines" = ""
|
|
return
|
|
end
|
|
set -l cmdlines (printf '%s\n' '#'$cmdlines | string replace -r '^##' '')
|
|
commandline -r $cmdlines
|
|
string match -q '#*' $cmdlines[1]
|
|
and commandline -f execute
|
|
end
|