mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-09 05:35:19 +02:00
hints kitten: Use default editor rather than hardcoding vim to open file at specific line
Fixes #7186
This commit is contained in:
@@ -81,6 +81,8 @@ Detailed list of changes
|
||||
|
||||
- kitten @ ls: Return the timestamp at which the window was created (:iss:`7178`)
|
||||
|
||||
- hints kitten: Use default editor rather than hardcoding vim to open file at specific line (:iss:`7186`)
|
||||
|
||||
|
||||
0.32.2 [2024-02-12]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -26,8 +26,10 @@ and adding them to the command line for the next command.
|
||||
|
||||
You can also press :sc:`goto_file_line` to select anything that looks like a
|
||||
path or filename followed by a colon and a line number and open the file in
|
||||
:program:`vim` at the specified line number. The patterns and editor to be used
|
||||
can be modified using options passed to the kitten. For example::
|
||||
your default editor at the specified line number (opening at line number will
|
||||
work only if your editor supports the +linenum command line syntax or is a
|
||||
"known" editor). The patterns and editor to be used can be modified using
|
||||
options passed to the kitten. For example::
|
||||
|
||||
map ctrl+g kitten hints --type=linenum --linenum-action=tab nvim +{line} {path}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from kitty.clipboard import set_clipboard_string, set_primary_selection
|
||||
from kitty.constants import website_url
|
||||
from kitty.fast_data_types import get_options
|
||||
from kitty.typing import BossType
|
||||
from kitty.utils import resolve_custom_file
|
||||
from kitty.utils import get_editor, resolve_custom_file
|
||||
|
||||
from ..tui.handler import result_handler
|
||||
|
||||
@@ -272,7 +272,10 @@ def linenum_handle_result(args: List[str], data: Dict[str, Any], target_window_i
|
||||
if not path:
|
||||
return
|
||||
|
||||
cmd = [x.format(path=path, line=line) for x in extra_cli_args or ('vim', '+{line}', '{path}')]
|
||||
if extra_cli_args:
|
||||
cmd = [x.format(path=path, line=line) for x in extra_cli_args]
|
||||
else:
|
||||
cmd = get_editor(path_to_edit=path, line_number=line)
|
||||
w = boss.window_id_map.get(target_window_id)
|
||||
action = data['linenum_action']
|
||||
|
||||
|
||||
@@ -4031,7 +4031,7 @@ map('Open the selected file at the selected line',
|
||||
'goto_file_line kitty_mod+p>n kitten hints --type linenum',
|
||||
long_text='''
|
||||
Select something that looks like :code:`filename:linenum` and open it in
|
||||
:program:`vim` at the specified line number.
|
||||
your default editor at the specified line number.
|
||||
'''
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user