Commit Graph

2570 Commits

Author SHA1 Message Date
Maxime Coste
e74424d889 Merge remote-tracking branch 'Frojdholm/rc-windowing-kitty-window-id' 2023-05-10 19:54:12 +10:00
Johannes Altmanninger
94e3ea9687 rc windowing wayland/x11: do not pollute terminal environment
The x11-terminal command spawns a potentially long-lived terminal
process. The terminal can is completely independent of the Kakoune
session that created it.
Due to how it's implemented, the spawned terminals will have
environment variables "kak_opt_termcmd" and  "kak_quoted_reg_a"
set.  This can be surprising, especially since, by convention, the
environment contains no lowercase variables. Let's stop exporting them.
2023-05-09 11:32:37 +02:00
Hampus Fröjdholm
7c54de2334 Match against kitty window id directly when using kitty @ launch
When launch matches using `id` kitty tries to match against tab id
before matching windows. When there are multiple tabs it's likely to
match a tab before matching a window.

Use `window_id` directly to avoid any possiblity of matching tabs.

This is only needed for `kitty @ launch` for other commands there is
no specific `window_id` field.
2023-05-07 17:06:09 +02:00
Johannes Altmanninger
be7a0695a8 rc: move remaining comment insertion hooks to *-insert group
This continues the work started by 0a9c90fec (rc: use a separate
*-insert hook to auto-insert comments, 2021-04-17).

The one that's left is Rust but that one is trickier.
2023-05-03 19:36:50 +02:00
Maxime Coste
86dc4130e1 Merge branch 'fix/hare-comment-insert' of http://github.com/stacyharper/kakoune 2023-03-13 21:38:01 +11:00
Maxime Coste
58ead47fb4 Merge remote-tracking branch 'krobelus/tmux' 2023-03-13 21:33:31 +11:00
Bob Qi
4f0334c476 add zellij-action command 2023-02-26 07:29:39 +08:00
Bob Qi
02bc786fb7 remove the option and provide session name explictly 2023-02-24 12:21:16 +08:00
Bob Qi
f33126c2a9 give up to wrap command into a shell to avoid conflict with connect.kak 2023-02-22 15:57:22 +08:00
Bob
4ff5de6273 Create zellij.kak 2023-02-22 13:17:04 +08:00
Maxime Coste
6b7ed51be1 Merge branch 'hare-packed' of http://github.com/stacyharper/kakoune 2023-01-27 11:26:17 +11:00
Maxime Coste
9763ce4fe9 Merge remote-tracking branch 'razetime/master' 2023-01-27 10:58:32 +11:00
Maxime Coste
247e4885e8 Merge remote-tracking branch 'm-kru/troff_headings_highlighting' 2023-01-18 07:46:36 +11:00
razetime
b794855c70 add APL highlighting 2023-01-14 11:04:16 +05:30
Adrià Arrufat
f92df3ec96 Add reset to git command docstring 2023-01-06 00:17:38 +09:00
Stacy Harper
8c4b591a9e
Add @packed to hare highlighter
ref: https://todo.sr.ht/~sircmpwn/hare/783
2023-01-02 20:38:12 +01:00
Michał Kruszewski
dddadce7e8 troff filetype: Fix headings highlighting 2022-12-30 21:45:17 +01:00
Răzvan C. Rădulescu
86bd4efd25 Add Python f-string interpolation highlights 2022-12-17 10:08:33 +11:00
Maxime Coste
e7e46ef76a Fix gas palign2 directive highlight 2022-12-06 17:47:32 +11:00
Maxime Coste
084fc5eb5a Merge remote-tracking branch 'lobre/fix-gopls-def-integration' 2022-12-03 08:41:10 +11:00
Maxime Coste
760a45556c Merge remote-tracking branch '2xsaiko/outgoing/newlines-for-iterm2' 2022-11-21 08:51:21 +11:00
Marco Rebhan
5530f49c14 Deduplicate iterm2 escaping code
This fixes PATH and TMPDIR not being escaped in the iterm-terminal-window and
iterm-terminal-tab commands.
2022-11-20 14:00:34 +01:00
Marco Rebhan
c57805a926 Handle spawning iTerm and screen commands with arguments containing newlines
Before, sed would add quotes to every line of the single multiline argument,
causing the final quoted argument to "split ... command" or screen to contain
unquoted newlines such as this (from kakoune-cr):

	tell application "iTerm"
	    tell current session of current window
	        tell (split vertically with same profile command "env PATH='...' 'sh' '-c' ''
	'    export KAKOUNE_SESSION=$1'
	'    export KAKOUNE_CLIENT=$2'
	'    shift 3'
	''
	'    [ $# = 0 ] && set \"$SHELL\"'
	''
	'    \"sh\"'
	'  ' '--' '51909' 'client0' 'terminal' ") to select
	    end tell
	end tell

Instead of using sed to do this which operates on single lines at a time, simply
use printf to insert ' quotes before and after the entire argument.
2022-11-20 14:00:09 +01:00
Stacy Harper
db93e776c5
Fix hare new line insert indentation after comments
At the moment, inserting a new line while being in a comment result in a
"//<indentation>" instead of "<indentation>//".

To fix this, we just paste the comment and indent after the newline
initial indentation.
2022-11-20 10:39:46 +01:00
Maxime Coste
d1e1f5df32 Merge remote-tracking branch 'Ssamm45/master' 2022-11-20 17:06:12 +11:00
Maxime Coste
5314e2375e Merge branch 'fix/hare-comment-insert' of http://github.com/stacyharper/kakoune 2022-11-20 17:03:14 +11:00
Johannes Altmanninger
f69d8c3e12 rc repl tmux: always spawn repl in calling client
Just like the parent commit but for tmux-repl-* commands.

Note that tmux-repl-set-pane without arguments is kind of broken; it
increments the current pane ID, which only works in the most basic
scenarios. We should probably replace it with something better,
with menu completions etc.
2022-11-19 15:21:38 +01:00
Johannes Altmanninger
cfea884cf2 rc windowing tmux: always spawn tmux-terminal-window in calling client
The tmux-terminal-window command always spawns windows in the tmux
session where the Kakoune session was started - even if the calling
Kakoune client lives in a different tmux session.

Fix this by always creating the window in the tmux
session of the calling client. We already do the same for
tmux-terminal-{horizontal,vertical}.

I call tmux-terminal-impl with "new-window -a" (instead of
"new-window"), so make sure the fix works for my use case.

I considered retrieving the tmux session ID from the $TMUX environment
variable but the tmux manpage only specifies that $TMUX contains
"some internal data".
2022-11-19 15:21:38 +01:00
Johannes Altmanninger
37dcba9089 rc repl tmux: do not record repl session/window since pane might move
A pane's ID is immutable for the lifetime of the tmux server.
Same with window/session IDs.
When creating a new tmux repl, we record all three IDs to later use
them to send text to the repl.
The window/session IDs can be invalidating when a pane is moved to
a different window/session (via "tmux move-pane", "tmux move-window"
etc). This will cause repl-send-text to fail.
Fix this by dropping the redundant and potentially incorrect
window/session IDs.  The immutable pane ID is enough.
2022-11-19 15:21:38 +01:00
Johannes Altmanninger
9891f11157 rc repl tmux: remove bashisms 2022-11-19 15:21:38 +01:00
Johannes Altmanninger
79db90349d rc repl tmux: show error when the repl pane is gone
tmux-send-text would silently fail when the repl is no more.  Let's
instead print an error, pointing the user to the *debug* buffer which
has tmux' stderr.
2022-11-19 15:21:38 +01:00
Stacy Harper
becb1ef843
Fix hare new line insert indentation after comments
At the moment, inserting a new line while being in a comment result in a
"//<indentation>" instead of "<indentation>//".

To fix this, we just re-order both InsertChar hooks.
2022-11-19 08:34:54 +01:00
Loric Brevet
84d72eb4ba
Make ctags.kak compatible with original awk
Positional arguments in awk’s printf is a feature that is only available
in the GNU implementation of awk (gawk). So the ctags auto-completion feature
was broken in Kakoune if the installed version of awk was nawk or mawk.
This simple change makes it retro-compatible with those versions.

See https://www.gnu.org/software/gawk/manual/html_node/Printf-Ordering.html
2022-11-18 12:37:55 +01:00
Sam Larkin
acee9d8328 switch from using '&' to '<a-&>' when indenting javascript comments to allow the
type of indentation to be preserved
2022-11-17 13:52:22 -07:00
Loric Brevet
199b7ea165
Adjust regex in gopls-def for when filepath contains a dash
When calling `:gopls definition`, the gopls LSP server returns the location of
the selected definition. Then, `gopls.kak` tries to parse this output to
feed the `:edit` command and open the file in Kakoune. To do this, it
uses `sed` to transform `<path>.go:<line>:<colstart>-<colend>` to `<path>.go
<line> <colstart>`. However, if the `<path>` contains a dash character,
the `sed` will fail and strip everything after this first dash, removing
the line and columns information.

Closes #4776
2022-11-15 10:10:24 +01:00
James Wainwright
078e5900a4 Add "union" as a keyword for Rust syntax 2022-11-01 21:29:07 +00:00
Maxime Coste
cb33918fa2 Merge remote-tracking branch 'eraserhd/codeowners' 2022-10-19 20:39:11 +11:00
Maxime Coste
b42cb090ee Merge remote-tracking branch 'krobelus/fix-man-jump' 2022-10-19 20:37:19 +11:00
Maxime Coste
e43c7d6aba Use complete-command for the :doc command 2022-10-19 20:35:05 +11:00
Maxime Coste
d1bfc5ecdc Shell-highlight complete-command shell completion parameters 2022-10-19 20:34:35 +11:00
Maxime Coste
65f4bf78e9 Merge remote-tracking branch 'krobelus/file-completion' 2022-10-19 20:23:39 +11:00
Maxime Coste
5de90920d4 Merge remote-tracking branch 'krobelus/modeline-readonly-fix' 2022-10-19 20:22:25 +11:00
Maxime Coste
39fe2438f7 Merge remote-tracking branch 'krobelus/url-at-word-boundary' 2022-10-19 20:20:47 +11:00
Maxime Coste
e8eb1c8732 Merge branch 'typescript-filetype' of http://github.com/clarfonthey/kakoune 2022-10-19 20:20:07 +11:00
Maxime Coste
aa77078a2e Merge remote-tracking branch 'krobelus/select-make-buffer-at-last' 2022-10-19 20:19:03 +11:00
Maxime Coste
bd23dbda00 Merge branch 'patch-4' of https://github.com/blaggacao/kakoune 2022-10-19 20:17:28 +11:00
Johannes Altmanninger
62bd1af3f0 rc modeline: fix error trying to write readonly global variable
When running modeline-parse on this file:

	# kakoune: filetype=ledger:indentwidth=4

I get this error from dash (and a similar one from bash):

	sh: 53: readonly: key: is read only

This is because the readonly variable "key" is used elsewhere, both
times as global. Fix this by making both variables local. While
at it, remove an unused variable.

Fixes #4478
2022-10-17 19:23:30 +02:00
ltdk
ab8b02720b Treat .cts and .mts as typescript 2022-10-16 20:23:05 -04:00
Johannes Altmanninger
daabb5da4e rc make: make-next-error to switch toolsclient to *make* buffer
This is equivalent to a change to grep.kak in 649e252f7 (bring *grep*
buffer to front in context of toolsclient, 2020-08-14).

If a toolsclient is set, make-next-error (and make-previous-error) will
jump to %opt{make_current_error_line}. This is wrong if the toolsclient
does not show the *make* buffer. In that case make_current_error_line
is undefined and we end up showing the goto menu. This has occasionally
been annoying me for a long time but I never bothered investigating.

Fix this by switching to the *make* buffer. The potential downside
is if make-next-error is run from the toolsclient, where we no longer
jump to the error but that's fine because we can use <ret>.

We can maybe improve this later by extending the logic, see
https://github.com/mawww/kakoune/pull/3656#pullrequestreview-472052285
2022-10-16 20:00:22 +02:00
Johannes Altmanninger
f7c3faa2e1 rc markdown taskpaper: require bare URL to start at word boundary
I can't think of a case where a URL would not start at a word boundary.
Let's add that to the regex. In addition to correctness, this also
slightly improves performance because matching can stop earlier.

	$ HOME=$PWD hyperfine -w 1 'git checkout HEAD'{~,}' -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy'
	Benchmark 1: git checkout HEAD~ -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy
	  Time (mean ± σ):      1.123 s ±  0.022 s    [User: 1.100 s, System: 0.027 s]
	  Range (min … max):    1.093 s …  1.174 s    10 runs
	 
	Benchmark 2: git checkout HEAD -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy
	  Time (mean ± σ):      1.019 s ±  0.026 s    [User: 1.001 s, System: 0.021 s]
	  Range (min … max):    0.984 s …  1.051 s    10 runs
	 
	Summary
	  'git checkout HEAD -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy' ran
	    1.10 ± 0.04 times faster than 'git checkout HEAD~ -- :/rc/filetype/markdown.kak && ./kak.opt big_markdown.md -e "hook global NormalIdle .* quit" -ui dummy'
2022-10-16 19:49:43 +02:00