neovim remote + tmux: how to make a new environment variable per session

20 views
Skip to first unread message

Daniel Meneses Báez

unread,
May 23, 2020, 4:18:41 PM5/23/20
to tmux-...@googlegroups.com
Hello,

I use tmux for everything and I love it. I use tmux plugins `pain-control` and `sessionist` to preserve CWD while forking panes, windows, and sessions. I find it very handy.

Since a few months now, I've been using `neovim-remote` that keeps a single instance of neovim shared among the shells with matching environment variable `NVIM_LISTEN_ADDRESS`. This is very handy because combined with vim plugin `vim-rooter` allows me to open a terminal in the project's root I'm currently working on, and then issue more `vim....` command that will execute in the only vim open for that tmux window. Forking to another window, starts the setup again, where just the first `vim` command actually opens a vim instance, and all later `vim` commands for that same tmux window are "captured" by the now window-local-vim

I've been looking to create my first tmux plugin in order to manage automatically `NVIM_LISTEN_ADDRESS` env var, the plugin, borrows heavily from `pain-control` and `sessionist` plugins.

The plugin sort of works, it has one dirty corner: creating a new session (click here to see the involved code).

As I can't use `-e` flag for `new-session` I've resorted to a very odd trick with `send-keys` that just feels wrong. I'm writing to check if anybody has faced a problem like this before or any other better approach.

Thank you in advanced

--
Daniel Baez

Nicholas Marriott

unread,
May 23, 2020, 4:33:13 PM5/23/20
to Daniel Meneses Báez, tmux-users
If you change it in the global environment, the first window in the new session will get it, then you could remove it again after you change the session environment.

Something like:

tmux start \; setenv -g X y \; new \; setenv -gu X


--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/CAOsX1NNz%2BHD4YLVnJZbiijtNpFhuwzuO1%3Dv_zCcWtvFH6tOY_Q%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages