One session for all projects

#1

I’m experimenting with @ulis’s workflow to live with a single session.

In this workflow, I use buffer and find-edit commands quite intensively, and one thing I missed was the ability to switch to the project root of the current buffer, so the use of find-edit is easy.

find-edit
define-command find-edit -params 1 -shell-script-candidates 'fd --type file' 'edit %arg(1)'
define-command find-edit-all -params 1 -shell-script-candidates 'fd --no-ignore --type file' 'edit %arg(1)'

alias global f find-edit
alias global fa find-edit-all

To solve that, I created a change-directory command and added a hook to automatically navigate into the project root of the current buffer:

hook global WinDisplay .* %{
  change-directory-buffer
  try change-directory-git
}
1 Like
#2

Thanks for sharing. I’ve been using similar commands in https://github.com/Delapouite/kakoune-cd

2 Likes
#3

I also improved Connect to handle this use case.

KAKOUNE_SESSION=othala
alias kak=kak-connect
#4

I’m not using multiple sessions at all. My use-case is simply – load up Kakoune and open project with fzf-project command from my fzf.kak script. It will automatically prompt me to choose file in this project to open. Searching files is not always from root, but if I’ve changed directory I can open files from root with fzf-git. If I need to work with another project, I can switch between them through fzf-project again.

This is more heavy solution than simply using shell candidates to get a list of files though.

#5

Using a single session works quite great over SSH. I’ve got rid of tmux ever since.

I’m using the following configuration:

And ssh <host> -t kak-connect.

Usually, I type the command once and repeat Up and Return in a new terminal.

1 Like