Commit graph

398 commits

Author SHA1 Message Date
Kovid Goyal
0108037076
Dont leak the ENV environ var we use to load our integration script into the shell 2022-02-22 21:29:32 +05:30
Kovid Goyal
88091b4ab3
BASH integration: No longer modify .bashrc to load shell integration
I think I have things setup robustly so that the shell integration
is loaded transparently via env vars and the normal bash startup files
are sourced, in the same way that vanilla bash does it. Let's hope I
haven't overlooked something.
2022-02-22 21:24:51 +05:30
Kovid Goyal
dac9b07f16
bash shell integration: Handle both literal and escaped newlines in PS1 2022-02-22 18:30:20 +05:30
Kovid Goyal
05617f7dca
strip kitty markup from ps1 before checking for newlines 2022-02-22 11:40:09 +05:30
Kovid Goyal
2d2f4b9ba9
Multi-line processing of bash prompts should only be done when the prompt actually contains a newline 2022-02-21 22:54:10 +05:30
Kovid Goyal
9bfa4553a8
Shell integration: bash: Fix rendering of multiline prompts with more than two lines
Fixes #4681
2022-02-11 06:08:34 +05:30
pagedown
f5415ca824
Restore XDG_DATA_DIRS right after fish integration script is loaded 2022-02-09 13:06:38 +08:00
Kovid Goyal
dc6138d286
Add a note about why we check _ksi_prompt_command 2022-02-08 19:52:02 +05:30
Kovid Goyal
7457f637a2
bash shell integration: Dont call _ksi_prompt_command from PROMPT_COMMAND unlessit is set 2022-02-08 19:48:30 +05:30
Kovid Goyal
f9d9fe6db4
Shell integration: bash: Dont fail if an existing PROMPT_COMMAND ends with a semi-colon
Fixes #4645
2022-02-06 19:02:39 +05:30
Kovid Goyal
bc873ad838
bash shell integration: To title and cursor escape codes at end of PS1/PS0 so that they override pre-existing ones
This is needed because some distros like Debian patch the default bashrc
to set a user@host:/pwd style title which is extremely unsuitable for
kitty.
2022-01-30 11:13:46 +05:30
Kovid Goyal
44e3a6f0fb
Shell integration: Set cursor shape to whatever is specified in the cursor_shape option when executing a command rather than the block shape 2022-01-25 13:30:48 +05:30
pagedown
a47b3bf578
Fix the blinking block cursor shape for commands in bash integration 2022-01-25 14:00:28 +08:00
pagedown
3aec573d40
Use blinking block for commands consistent with zsh and bash integration 2022-01-25 13:58:11 +08:00
pagedown
5d4b0c0bef
Set the pre-exec cursor shape in fish vi mode and config on demand 2022-01-25 13:01:54 +08:00
pagedown
11c0343420
Add comments and minor tweaks to fish integration 2022-01-25 11:52:34 +08:00
Kovid Goyal
287b843d13
add a comment 2022-01-24 22:14:56 +05:30
Kovid Goyal
1fea4777fa
zsh shell integration: Restore cursor to blinking block before running external commands 2022-01-24 22:06:52 +05:30
pagedown
c5e8a36f9b
Shell integration: Improvements for fish integration
Move the completion function to the autocomplete script.
Fix some issues with cursor shape setting, respect user configuration.
Functions and vars start with two underscores, following the convention.
Other minor refactoring.
2022-01-19 09:39:23 +08:00
Kovid Goyal
71106bcd39
Shell integration: Dont override fish's native title setting functionality
See discussion: https://github.com/fish-shell/fish-shell/issues/8641
2022-01-16 15:58:11 +05:30
Kovid Goyal
fa6c74a9b1
... 2022-01-15 11:49:02 +05:30
Kovid Goyal
8174ecb318
Use only bash builtins to get currently executing command 2022-01-15 11:46:25 +05:30
Kovid Goyal
5f20d69309
Move extraction of last cmd into its own function 2022-01-15 10:58:16 +05:30
pagedown
85254746bf
Shell integration: Remove functions that run only once at start 2022-01-15 12:34:52 +08:00
pagedown
77787bdc7c
Shell integration: Improvements in fish integration 2022-01-15 12:01:47 +08:00
pagedown
9813ad04c2
Shell integration: Set the fish vi mode cursor to blink 2022-01-15 10:29:26 +08:00
Kovid Goyal
e51b520897
Merge branch 'ksi-fish-title' of https://github.com/page-down/kitty 2022-01-14 23:29:48 +05:30
Kovid Goyal
35207af3de
Another use of builtin 2022-01-14 23:28:10 +05:30
Kovid Goyal
96269510d3
Abort before defining anything and dont touch global state via set 2022-01-14 23:26:40 +05:30
pagedown
ceb7c440a1
Shell integration: Only override default fish_title 2022-01-15 01:46:14 +08:00
Kovid Goyal
25e1edf52e
... 2022-01-14 23:03:44 +05:30
Kovid Goyal
7a903adeea
let _ksi_debug_print handle multiple args 2022-01-14 22:53:39 +05:30
Kovid Goyal
914f4e9ec9
Dont break if user aliases or redefines various builtins we use 2022-01-14 22:47:49 +05:30
Kovid Goyal
4c5673dc4d
Freeze _ksi_prompt to prevent it from being edited 2022-01-14 22:35:37 +05:30
pagedown
a0476c03c3
Improve fish cursor shape integration 2022-01-14 22:57:31 +08:00
Kovid Goyal
9dd5410433
Dont rely on declare -g existing in bash 2022-01-14 18:21:21 +05:30
Kovid Goyal
b53d756bc2
Shell integration: Fix bash integration not working when PROMPT_COMMAND is used to change the prompt variables
Fixes #4476
2022-01-14 12:14:48 +05:30
Roman Perepelitsa
6c1fd3015f Fix a minor bug in zsh integration
This bug is extremely unlikely to cause issues.
2022-01-09 10:45:47 +01:00
Silent Crafter
e106562ef1
Bash: for loop array iteration fix
the array iteration wasn't implemented correctly for KITTY_SHELL_INTEGRATION variable. the i variable in for loop wasn't iterating through all the elements of that array
2022-01-06 09:52:59 +05:30
Kovid Goyal
d3a20f00d6
Add a comment explaining where we use PS2 marks 2022-01-06 09:25:41 +05:30
Kovid Goyal
a574081012
Merge branch 'zsh-integration' of https://github.com/romkatv/kitty 2022-01-05 21:29:30 +05:30
Roman Perepelitsa
4f06ce9d72 Once again start embedding marks in PS2 on zsh 2022-01-05 16:36:00 +01:00
Kovid Goyal
6713580455
Explicitly turn off aliases in a more functions
Not really needed, but I like to be explicit
2022-01-05 21:04:27 +05:30
Roman Perepelitsa
9194d1db6b Disable aliases when patching functions in zsh integration 2022-01-05 16:16:18 +01:00
Roman Perepelitsa
8009b85073 Make writing to the TTY more robust in zsh integration
See https://github.com/kovidgoyal/kitty/issues/4440.
2022-01-05 09:55:19 +01:00
Roman Perepelitsa
4decac26f6 Fix a typo in _ksi_debug_print 2022-01-05 09:22:00 +01:00
Roman Perepelitsa
a6b74f190f Revert "Get _ksi_debug_print working again"
This reverts commit ff63e58f95.
2022-01-05 09:20:33 +01:00
Kovid Goyal
266e70222f
Avoid hooking LE widgets at all when using no-cursor 2022-01-05 07:46:20 +05:30
Roman Perepelitsa
ca8975891b Replace add-zle-hook-widget with a series of hacks in zsh integration 2022-01-04 19:56:57 +01:00
Kovid Goyal
78495a7f64
spelling 2022-01-04 20:35:21 +05:30
Kovid Goyal
dadf496a68
remove leftover debug print 2022-01-04 12:01:23 +05:30
Kovid Goyal
f17d71454a
... 2021-12-31 22:51:16 +05:30
Kovid Goyal
59ea7485e4
Fix loading of kitty completions broken by unfunctioning of kitty-integration 2021-12-31 22:49:09 +05:30
Kovid Goyal
ff63e58f95
Get _ksi_debug_print working again 2021-12-31 22:38:39 +05:30
pagedown
ae35507f80
Use the lowercase kitty 2021-12-24 12:02:54 +08:00
pagedown
73ff508b51
Docs: unfunction kitty-integration 2021-12-24 11:46:08 +08:00
Roman Perepelitsa
9bba38bd11 Unfunction kitty-integration in zsh 2021-12-23 19:09:09 +01:00
Roman Perepelitsa
37741ac808 Add a comment within zsh integration related to cursor shape changes 2021-12-22 15:04:31 +01:00
Roman Perepelitsa
6d790237c3 Rewrite zsh integration
Note:

- Very lightly tested.
- Docs not updated.
2021-12-22 14:04:40 +01:00
Roman Perepelitsa
09d025d88f Minor robustness improvements to zsh shell integration 2021-12-20 13:20:38 +01:00
Kovid Goyal
9441cf15c3
Move the bash integration script into its own dir
This matches the other shells and might be useful someday
if bash ever gets a way for the invoking process to inject code
into it.

Also use KITTY_INSTALLATION_DIR when loading the bash integration code.
2021-11-29 12:30:10 +05:30
Kovid Goyal
daefb926d9
Fix zsh kitty completion when the matching style includes anchor based matchers
Debian apparently adds these by default.
2021-11-28 11:02:03 +05:30
Kovid Goyal
3d76c916a5
Simplify zsh shell integration code
Use the add-zsh-hook and add-zle-hook-widget functions
2021-11-28 08:45:53 +05:30
Kovid Goyal
0a5ffe9b73
Add a note about _ksi_first_run 2021-11-28 08:14:16 +05:30
Kovid Goyal
325603bf41
Shell integration zsh: Handle the case when a function that breaks prompt marking is installed after _ksi_precmd
We now install the real precmd hook only in the first run of the precmd
hook. This ensures that our precmd and preexec hooks are run last,
unless something else uses this trick, which is unlikely, and at that
point, the user is on their own.

Also ensure that the integration script is run only once even if the
user tries to source it twice with setting of KITTY_SHELL_INTEGRATION
each time.
2021-11-27 12:24:19 +05:30
Kovid Goyal
f6e0eb4005
Shell integration: Dont modify ~/.zshrc
Instead use the ZDOTDIR env var to load the shell integration code
2021-11-27 07:19:59 +05:30
Kovid Goyal
cf7e43fa26
Simplify nested if 2021-11-07 19:23:31 +05:30
Kovid Goyal
b5e8b5a124
Allow users to modify XDG_DATA_DIRS in the fish rc files
The only downside of this new technique is that it is no
longer possible to set XDG_DATA_DIRS to an empty var in kitty.conf
Since an empty XDG_DATA_DIRS breaks lots fo things, I dont think that
is a big concern.
2021-11-07 18:59:50 +05:30
Kovid Goyal
f48a430493
Use --global when re-exporting XDG_DATA_DIRS 2021-11-07 10:31:57 +05:30
Kovid Goyal
35514e0cc3
Dont change XDG_DATA_DIRS for child processes in fish shell integration
Fixes #4199
2021-11-07 10:06:18 +05:30
Kovid Goyal
5eb87b9f10
Micro-optimizations of fish sheel integration script
By @page-down
2021-10-29 21:51:48 +05:30
Kovid Goyal
d3a3f99848
Use an env var for fish shell integration
Less intrusive (in some ways) than adding symlinks to ~/.config/fish
Exploits the fact that fish loads scripts from XDG_DATA_DIRS on startup.
Thanks to @page-down for noticing
2021-10-27 14:59:11 +05:30
Kovid Goyal
089ab9ee9f
Use a pre zsh 5.5 syntax for assoc arrays 2021-10-24 08:16:44 +05:30
Kovid Goyal
899b5078eb
bash integration: fix newline replace in PS1 2021-10-23 18:48:45 +05:30
Kovid Goyal
0f9944190d
Shell integration: Better fix for multi-line prompts in bash
Also fix bash redrawing only the last PS2 prompt
2021-10-22 12:19:03 +05:30
Kovid Goyal
6d02ef59f8
Shell integration: Fix PS2 support
zsh only redraws the prompt from the last PS2 on a multiline prompt.
Take this into account.
2021-10-22 12:02:21 +05:30
Kovid Goyal
eeb02ceef4
Shell integration: Workaround bash not redrawing multiline prompts 2021-10-01 09:30:26 +05:30
Kovid Goyal
f277cbf3f3
Improved trailing newline handling in the fish shell integration
Thanks to some assistance from @faho
See https://github.com/kovidgoyal/kitty/issues/4032#issuecomment-919936913
2021-09-15 21:06:28 +05:30
Kovid Goyal
0a56ab7a1e
Workaround for fish splitting on newlines when doing command substitution 2021-09-15 18:12:40 +05:30
Kovid Goyal
a073936997
Fish shell integration: Strip trailing newlines from the original fish prompt as fish does this 2021-09-15 16:58:31 +05:30
Kovid Goyal
72e15d8b4f
Fish integration: Have the value of $status preserved by the prompt functions 2021-08-24 20:29:12 +05:30
Kovid Goyal
a10c19456a
Fix completions for fish 2021-08-18 10:06:07 +05:30
Kovid Goyal
f4b3948168
Use a shortened dir path for window title
Also respect named directories
2021-08-18 10:06:07 +05:30
Kovid Goyal
2245d4506f
Add title and cursor to fish integration 2021-08-18 10:06:06 +05:30
Kovid Goyal
7f3da135e2
... 2021-08-18 10:06:06 +05:30
Kovid Goyal
23f94b6e67
Get prompt marking working for th fish shell 2021-08-18 10:06:06 +05:30
Kovid Goyal
0ec10b52e0
Add shebangs 2021-08-18 10:06:06 +05:30
Kovid Goyal
a993a71857
Add shell integration for bash 2021-08-18 10:06:06 +05:30
Kovid Goyal
6e172bdc09
Fix cursor in zsh vicmd mode 2021-08-18 10:06:06 +05:30
Kovid Goyal
725ec57bee
Automatically setup shell integration for ZSH 2021-08-18 10:06:06 +05:30
Kovid Goyal
2263cd1355
Use a _ksi_ prefix for shell integration
Sadly function in zsh are global so prefix all function and global var
names with _ksi_ as poor mans namespacing.
2021-08-18 10:06:05 +05:30
Kovid Goyal
1bb87c71aa
Make all shell integrations disablable 2021-08-18 10:06:05 +05:30
Kovid Goyal
7dec7d615a
Use an env var to control shell integration 2021-08-18 10:06:05 +05:30
Kovid Goyal
2e5308ad40
Use an associative array for prompt data 2021-08-18 10:06:05 +05:30
Kovid Goyal
d1015de700
Workaround for base64 on linux inserting line breaks by default 2021-08-18 10:06:05 +05:30
Kovid Goyal
85f6d3fed8
Use PS1 to set the prompt start mark
Needed as precmd functions are not called when redrawing the prompt. As
far as I can tell zsh stupidly has no hook that is called when the
prompt is redrawn after a window resize or when a background job
finishes.
2021-08-18 10:06:05 +05:30
Kovid Goyal
a4925eeeb4
... 2021-08-18 10:06:05 +05:30
Kovid Goyal
46b9aca16e
Start work on shell integration 2021-08-18 10:06:04 +05:30