Jumping to file:line:col

if I have a file with lines like foofile.ext:line:col:\tDescription and I want to be able to turn the lines into jumps is there a filetype I can just turn on or something easy?

Sometimes it is too easy – answered by @occivink on IRC.

:set window filetype grep

1 Like

solution to your problem, but Kakoune has builtin gf command that can open file from selection. Though it doesn’t follow any format, just treats string as a straight file path and doesn’t handle line number jump.

Boyd by @occivink sense of confidence and @robertmeta’s kakrc I have now spent far too much time diminishing my own confidence so I ask for some help. Can these two mappings be combined into a single mapping or do I need to define my own command? Thanks in advance.

The second mapping is used on the grep buffer, which highlights the contents and pipes the selection into the sort command. The result is that NOTE is displayed before TODO on the grep buffer list.

map global user ‘B’ %{: grep -E "TODO|NOTE" %val{bufname} <ret>}
map global user ‘<c-b>’ %{<esc>%|sort -t '/' -k 2<ret><esc>ggd}


Just in case anyone asks:
addhl window/ regex (?S)\b(TODO[:(](.+?(?=\s\*/)|.+)) 1:black,yellow+fg
addhl window/ regex (?S)\b(NOTE[:(](.+?(?=\s\*/)|.+)) 1:red,white+fg

So I have tryed to chain the above in and out of map / hook / define-command / execute-keys / evaluate-command all have the same result no second sequence execution on the following keys. Unless I hit the key sequence myself on the *grep* buffer.

I can’t seem to chain any execute-keys or evaluate-command after the above grep command it’s driving me crazy. I must sort that *grep* buffer in alphabetical order! Or I just can’t sleep. Any help would be great, thanks guys.

I am using Kakoune v2019.01.20.

Alright, alright, and alright! Got to this:

map global user 'B' ': grep -E "TODO|NOTE" %val{bufname} <ret> : grep-sort-buffer' -docstring "grep sort NOTE then TODO's"

define-command grep-sort-buffer %{
    try %{ execute-keys -buffer *grep* '%|sort -t "/" -k 2<ret>ggd' }

Just requires one more push tomorrow the <ret> key just wont work…losing it.
I thought it may be a NormalIdle wait sequence filetype=grep or something. It definitely got the better of me.

Also works with {: grep -E "TODO|NOTE" . <ret>} for on start pwd kak client useful on a project grep and '%|sort -t "/" -k 3<ret>ggd' for sort.

Cant let it go, I at this stage the neighbors are ducking me yelling just sort it out!
Current key combo is probably worst way a human has ever sorted lines.

try %{ execute-keys -buffer *grep* 'gjd%s/[*/]<ret>&%s\s\s+<ret>c<space><esc>&<space>%|sort -k 3<ret>gg' }

The remaining problem is the numerical occurrences ascending in file order while maintaining the alphabetical grouping.

Perhaps someone with sed knowledge may do the trick sed1line.txt. Or just someone, anyone save me…can’t find the emoji for completely shattered.