mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Support absolute paths to $EDITOR
This commit is contained in:
parent
012d8d03e8
commit
0d91a6ce77
1 changed files with 11 additions and 2 deletions
|
@ -107,7 +107,7 @@ class Pry
|
|||
# not to block the process from which they were launched (in this case, Pry).
|
||||
# For those editors, return the flag that produces the desired behavior.
|
||||
def blocking_flag_for_editor(block)
|
||||
case Pry.config.editor.split("/").last
|
||||
case editor_name
|
||||
when /^emacsclient/
|
||||
'--no-wait' unless block
|
||||
when /^[gm]vim/
|
||||
|
@ -129,7 +129,7 @@ class Pry
|
|||
# special case for 1st line
|
||||
return file_name if line_number <= 1
|
||||
|
||||
case Pry.config.editor
|
||||
case editor_name
|
||||
when /^[gm]?vi/, /^emacs/, /^nano/, /^pico/, /^gedit/, /^kate/
|
||||
"+#{line_number} #{file_name}"
|
||||
when /^mate/, /^geany/
|
||||
|
@ -149,6 +149,15 @@ class Pry
|
|||
end
|
||||
end
|
||||
|
||||
# Get the name of the binary that Pry.config.editor points to.
|
||||
#
|
||||
# This is useful for deciding which flags we pass to the editor as
|
||||
# we can just use the program's name and ignore any absolute paths.
|
||||
#
|
||||
def editor_name
|
||||
Pry.config.editor.split("/").last.split(" ").first
|
||||
end
|
||||
|
||||
# Remove any common leading whitespace from every line in `text`.
|
||||
#
|
||||
# This can be used to make a HEREDOC line up with the left margin, without
|
||||
|
|
Loading…
Add table
Reference in a new issue