From 474a89b198a3e890a7753f11e3207c49c3c3644f Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Wed, 3 May 2023 10:39:06 +0200 Subject: [PATCH] nvim: nvim and tmux cwd fix --- .config/nvim/lua/config/options.lua | 7 +++++-- .tmux.conf | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua index fb8d091..7532f9f 100644 --- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/options.lua @@ -9,7 +9,7 @@ vim.o.splitright = true vim.o.ttimeout = true vim.o.ttimeoutlen = 50 vim.o.updatetime = 100 -vim.o.autochdir = false +vim.o.autochdir = true vim.o.backupdir = "/home/dln/.local/share/nvim/backup/" vim.o.backup = true vim.g.netrw_dirhistmax = 0 @@ -72,4 +72,7 @@ vim.keymap.set("n", ",L", ":luafile %") -- Reload lua file -- AutoCommand OSC7 workaround for tmux -- see https://github.com/neovim/neovim/issues/21771 -vim.cmd([[autocmd DirChanged * call chansend(v:stderr, printf("\033]7;file://%s\033\\", v:event.cwd))]]) +vim.api.nvim_create_autocmd("dirchanged", { + pattern = "*", + command = 'call chansend(v:stderr, printf("\\033]7;%s\\033", v:event.cwd))', +}) diff --git a/.tmux.conf b/.tmux.conf index 11ef005..bb50935 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -53,9 +53,10 @@ bind-key -T copy-mode-vi WheelDownPane select-pane \; send-keys -X -N 1 scroll-d bind-key / copy-mode \; send-key ? bind-key P 'capture-pane' \; capture-pane -S - \; save-buffer /tmp/tmux \; delete-buffer bind-key -n C-\\ copy-mode \; send -X search-backward " % "\; send -X search-again -bind -n M-g display-popup -h '90%' -w '90%' -b rounded -d '#{pane_current_path}' -E "gitui" -bind -n M-e display-popup -h '40%' -w '90%' -y 0 -b rounded -d '#{pane_current_path}' -e FZF=fzf -E "~/bin/tmux-edit-helper" -bind -n M-m display-popup -h '90%' -w '90%' -b rounded -d '#{pane_current_path}' -E "~/bin/tmux-build-helper" +bind -n M-g display-popup -h '90%' -w '90%' -b rounded -d '#{?pane_path,#{pane_path},#{pane_current_path}}' -E "gitui" +bind -n M-e display-popup -h '40%' -w '90%' -y 0 -b rounded -d '#{?pane_path,#{pane_path},#{pane_current_path}}' -e FZF=fzf -E "~/bin/tmux-edit-helper" +bind -n M-m display-popup -h '90%' -w '90%' -b rounded -d '#{?pane_path,#{pane_path},#{pane_current_path}}' -E "~/bin/tmux-build-helper" + setw -g window-status-format "" setw -g window-status-current-format ""