-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration changes aren't being read #15
Comments
Also im noticing the menu tries to rebuild and it fails with this error (this happens when I don't include
And if I try to put any of the xdg settings like so
It errors saying "empty value" |
@NovaViper You have to convert it from yaml -> tmux which you will have to do in a derivation since the autobuild will try to do in the /nix/store which is read-only. The yaml is never read at runtime. See https://github.com/alexwforsythe/tmux-which-key/pull/9/files which was never merged that includes a home manager module to take care of all this. It can do the conversion from yaml or you configure everything directly in nix. It also includes an app to convert the default config to nix also if you want. Feel free to upstream the home manager module if you want. I am now using zellij instead of tmux, but this plugin still works in my tmux config https://github.com/higherorderfunctor/nixos-config/blob/042d8dc09a03a266359a872fe24582b0761438b4/home/caubut/features/cli/tmux/default.nix#L24-L27. Note that I am using the flake.nix in my branch for the MR as the input: https://github.com/higherorderfunctor/nixos-config/blob/042d8dc09a03a266359a872fe24582b0761438b4/flake.nix#L140-L144. |
This is the actual config format used at runtime: https://github.com/alexwforsythe/tmux-which-key/blob/main/plugin/init.example.tmux There is a python script to convert from yaml to tmux which the home manager module wraps in a derivation: https://github.com/alexwforsythe/tmux-which-key/pull/9/files#diff-f3ff5cfee44f7b78091278fbbd2378a1de43ce295e8bedf7e0fc794d230c53c2R48-R82 I add the yaml to the xdg config directory, but it is not actually used. xdg = {
configFile."${pluginPath}/config.yaml".source = configYaml; # just for reference
dataFile."${pluginPath}/init.tmux".source = configTmux; # the actual runtime config used
}; The runtime config is in ~/.local/share. $ cat ~/.local/share/tmux-plugins/tmux-which-key/init.tmux
#
# Generated by generate_plugin.py.
#
# init.tmux: called by plugin.sh.tmux to initialize the plugin.
#
display -p '[tmux-which-key] Loading plugin ...'
#
# User options
#
set -g @wk_cfg_key_root_table "C-Space"
set -g @wk_cfg_key_prefix_table "Space"
set -g @wk_cfg_title_style "align=centre,bold"
set -g @wk_cfg_title_prefix "tmux"
set -g @wk_cfg_title_prefix_style "fg=green,align=centre,bold"
set -g @wk_cfg_pos_x "R"
set -g @wk_cfg_pos_y "P"
#
# Custom variables
#
setenv -h log_info "#[fg=green,italics] [info]#[default]#[italics]"
#
# Menus
#
set -g @wk_menu_copy \
'Copy "c" copy-mode \
"List buffers" "#" list-buffers'
set -g @wk_menu_layout \
'Next "l" "nextl ; show-wk-menu #{@wk_menu_layout}" \
Tiled "t" "selectnl tiled" \
Horizontal "h" "selectl even-horizontal" \
Vertical "v" "selectl even-vertical" \
"Horizontal main" "H" "selectl main-horizontal" \
"Vertical main" "V" "selectl main-vertical"'
set -g @wk_menu_windows \
'Last "tab" last-window \
Choose "w" "choose-tree -Zw" \
Previous "p" previous-window \
Next "n" next-window \
New "c" "neww -c #{pane_current_path}" \
"" \
"+Layout" "l" "show-wk-menu #{@wk_menu_layout}" \
"Split horiztonal" "/" "splitw -h -c #{pane_current_path}" \
"Split vertical" "-" "splitw -v -c #{pane_current_path}" \
Rotate "o" "rotatew ; show-wk-menu #{@wk_menu_windows}" \
"Rotate reverse" "O" "rotatew -D ; show-wk-menu #{@wk_menu_windows}" \
"" \
Rename "R" "command-prompt -I \"#W\" \"renamew -- \\"%%\\"\"" \
Kill "X" "confirm -p \"Kill window #W? (y/n)\" killw"'
set -g @wk_menu_resize \
'Left "h" "resizep -L ; show-wk-menu #{@wk_menu_resize}" \
Down "j" "resizep -D ; show-wk-menu #{@wk_menu_resize}" \
Up "k" "resizep -U ; show-wk-menu #{@wk_menu_resize}" \
Right "l" "resizep -R ; show-wk-menu #{@wk_menu_resize}" \
"Left more" "H" "resizep -L 10 ; show-wk-menu #{@wk_menu_resize}" \
"Down more" "J" "resizep -D 10 ; show-wk-menu #{@wk_menu_resize}" \
"Up more" "K" "resizep -U 10 ; show-wk-menu #{@wk_menu_resize}" \
"Right more" "L" "resizep -R 10 ; show-wk-menu #{@wk_menu_resize}"'
set -g @wk_menu_panes \
'Last "tab" lastp \
Choose "p" "displayp -d 0" \
"" \
Left "h" "selectp -L" \
Down "j" "selectp -D" \
Up "k" "selectp -U" \
Right "l" "selectp -R" \
"" \
Zoom "z" "resizep -Z" \
"+Resize" "r" "show-wk-menu #{@wk_menu_resize}" \
"Swap left" "H" "swapp -t \"{left-of}\"" \
"Swap down" "J" "swapp -t \"{down-of}\"" \
"Swap up" "K" "swapp -t \"{up-of}\"" \
"Swap right" "L" "swapp -t \"{right-of}\"" \
Break "!" break-pane \
"" \
Mark "m" "selectp -m" \
Unmark "M" "selectp -M" \
Capture "C" capture-pane \
"Respawn pane" "R" restart-pane \
Kill "X" "confirm -p \"Kill pane #P? (y/n)\" killp"'
set -g @wk_menu_buffers \
'Choose "b" "choose-buffer -Z" \
List "l" lsb \
Paste "p" pasteb'
set -g @wk_menu_sessions \
'Choose "s" "choose-tree -Zs" \
New "N" new \
Rename "r" rename'
set -g @wk_menu_plugins \
'Install "i" "run-shell $TMUX_PLUGIN_MANAGER_PATH/tpm/bindings/install_plugins" \
Update "u" "run-shell $TMUX_PLUGIN_MANAGER_PATH/tpm/bindings/update_plugins" \
Clean "c" "run-shell $TMUX_PLUGIN_MANAGER_PATH/tpm/bindings/clean_plugins"'
set -g @wk_menu_client \
'Choose "c" "choose-client -Z" \
Last "l" "switchc -l" \
Previous "p" "switchc -p" \
Next "n" "switchc -n" \
"" \
Refresh "R" refresh \
"+Plugins" "P" "show-wk-menu #{@wk_menu_plugins}" \
Detach "D" detach \
Suspend "Z" suspendc \
"" \
"Reload config" "r" reload-config \
Customize "," "customize-mode -Z"'
set -g @wk_menu_root \
'Run "space" command-prompt \
"Last window" "tab" last-window \
"Last pane" "`" last-pane \
Copy "c" "show-wk-menu #{@wk_menu_copy}" \
"" \
"+Windows" "w" "show-wk-menu #{@wk_menu_windows}" \
"+Panes" "p" "show-wk-menu #{@wk_menu_panes}" \
"+Buffers" "b" "show-wk-menu #{@wk_menu_buffers}" \
"+Sessions" "s" "show-wk-menu #{@wk_menu_sessions}" \
"+Client" "C" "show-wk-menu #{@wk_menu_client}" \
"" \
Time "T" clock-mode \
"Show messages" "\~" show-messages \
"+Keys" "?" "list-keys -N"'
#
# Macros
#
set -gF @wk_cmd_show \
"display-menu \
-x '#{@wk_cfg_pos_x}' \
-y '#{@wk_cfg_pos_y}' \
-T '#[#{@wk_cfg_title_style}]#[#{@wk_cfg_title_prefix_style}]#{@wk_cfg_title_prefix}#[#{@wk_cfg_title_style}]'"
set -gF command-alias[200] show-wk-menu=\
'#{@wk_cmd_show}'
set -gF command-alias[201] show-wk-menu-root=\
'#{@wk_cmd_show} #{@wk_menu_root}'
set -gF command-alias[202] reload-config=\
'display "#{log_info} Loading config... " ; \
source-file $HOME/.tmux.conf ; \
display -p "\n\n... Press ENTER to continue"'
set -gF command-alias[203] restart-pane=\
'display "#{log_info} Restarting pane" ; \
respawnp -k -c #{pane_current_path}'
#
# Keybindings
#
display -p "[tmux-which-key] Binding root table key to #{@wk_cfg_key_root_table} ..."
run-shell "tmux bind-key -Troot #{@wk_cfg_key_root_table} show-wk-menu-root"
display -p "[tmux-which-key] Binding prefix table key to #{@wk_cfg_key_prefix_table} ..."
run-shell "tmux bind-key -Tprefix #{@wk_cfg_key_prefix_table} show-wk-menu-root"
display -p '[tmux-which-key] Done' |
Ah that explains why I couldn't get it read the config file. I hadn't realized the home-manager module itself was rather complicated (due to having to rely on the build script); I don't see myself being able to maintain for the long term but I can at least get the package added into nixpkgs |
Hey I'm trying to get the plugin to work with my config.yaml but it doesn't appear to even register the changes at all despite me having
set -g @tmux-which-key-xdg-enable 1
in my tmux file (I have it declared in NixOS/Home-Manager).Config.yaml (it's not gonna be the final one but just trying to make it function)
The text was updated successfully, but these errors were encountered: