mirror of
https://github.com/zoriya/flake.git
synced 2025-12-18 04:25:17 +00:00
Remake tmux config
This commit is contained in:
@@ -3,23 +3,41 @@
|
|||||||
(pkgs.writeShellScriptBin "tmux-sessionizer" (builtins.readFile ./tmux-sessionizer.sh))
|
(pkgs.writeShellScriptBin "tmux-sessionizer" (builtins.readFile ./tmux-sessionizer.sh))
|
||||||
];
|
];
|
||||||
|
|
||||||
xdg.configFile."tmux/tmux.conf".text = ''
|
programs.tmux = {
|
||||||
unbind C-b
|
enable = true;
|
||||||
set -g prefix C-t
|
terminal = "tmux-256color";
|
||||||
bind -N "Send the prefix key through to the application" t send-prefix
|
|
||||||
|
|
||||||
set -g mouse on
|
mouse = true;
|
||||||
|
focusEvents = true;
|
||||||
|
aggressiveResize = true;
|
||||||
|
clock24 = true;
|
||||||
|
|
||||||
|
historyLimit = 50000;
|
||||||
|
# default is 500 which makes vim's esc slow, we do not want 0 because it won't be able to read osc
|
||||||
|
escapeTime = 50;
|
||||||
|
|
||||||
|
keyMode = "vi";
|
||||||
|
prefix = "C-t";
|
||||||
|
|
||||||
|
plugins = with pkgs.tmuxPlugins; [fzf-tmux-url];
|
||||||
|
|
||||||
|
extraConfig =
|
||||||
|
#tmux
|
||||||
|
''
|
||||||
set -g status off
|
set -g status off
|
||||||
set -g set-clipboard on
|
set -s set-clipboard on
|
||||||
set -g focus-events on
|
|
||||||
|
# from tmux-sensible
|
||||||
|
set -g display-time 4000
|
||||||
|
set -g status-interval 5
|
||||||
|
|
||||||
set-window-option -g mode-keys vi
|
|
||||||
bind-key v copy-mode
|
bind-key v copy-mode
|
||||||
bind-key -T copy-mode-vi i send -X cancel
|
bind-key -T copy-mode-vi i send -X cancel
|
||||||
bind-key -T copy-mode-vi v send -X begin-selection
|
bind-key -T copy-mode-vi v send -X begin-selection
|
||||||
bind-key -T copy-mode-vi V send -X select-line
|
bind-key -T copy-mode-vi V send -X select-line
|
||||||
bind-key -T copy-mode-vi y send -X copy-selection -x
|
bind-key -T copy-mode-vi y send -X copy-selection -x
|
||||||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection -x
|
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection -x
|
||||||
|
bind-key -T copy-mode-vi p { refresh-client -l; run -d0.05; paste-buffer; send -X cancel }
|
||||||
|
|
||||||
bind-key [ copy-mode \; send-keys -X previous-prompt
|
bind-key [ copy-mode \; send-keys -X previous-prompt
|
||||||
bind-key ] copy-mode \; send-keys -X next-prompt
|
bind-key ] copy-mode \; send-keys -X next-prompt
|
||||||
@@ -31,11 +49,9 @@
|
|||||||
bind-key C-s run-shell "tmux-sessionizer ~/projects/flake"
|
bind-key C-s run-shell "tmux-sessionizer ~/projects/flake"
|
||||||
bind-key C-n run-shell "tmux-sessionizer ~/projects/blog"
|
bind-key C-n run-shell "tmux-sessionizer ~/projects/blog"
|
||||||
|
|
||||||
run-shell ${pkgs.tmuxPlugins.sensible.rtp}
|
# suspend inner tmux (to allow nested sessions)
|
||||||
run-shell ${pkgs.tmuxPlugins.fzf-tmux-url.rtp}
|
bind -T root @ { set prefix None; set key-table off }
|
||||||
|
bind -T off C-@ { set -u prefix; set -u key-table }
|
||||||
# https://github.com/tmux/tmux/issues/4162
|
|
||||||
set -gu default-command
|
|
||||||
set -g default-shell "$SHELL"
|
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ vim.opt.completeopt = { "menuone", "popup", "noinsert", "fuzzy" }
|
|||||||
vim.opt.pumheight = 15
|
vim.opt.pumheight = 15
|
||||||
|
|
||||||
vim.opt.spelloptions = { "camel", "noplainbuffer" }
|
vim.opt.spelloptions = { "camel", "noplainbuffer" }
|
||||||
vim.opt.spelllang = { "en", "cjk", }
|
vim.opt.spelllang = { "en", "programming", "cjk", }
|
||||||
vim.opt.spell = true
|
vim.opt.spell = true
|
||||||
|
|
||||||
-- Can't specify this in wordmotion's config due to race conditions
|
-- Can't specify this in wordmotion's config due to race conditions
|
||||||
@@ -62,18 +62,25 @@ vim.keymap.set({ "n", "x" }, "<leader>y", '"+y', { desc = "Yank to system clipbo
|
|||||||
vim.keymap.set({ "n", "x" }, "<leader>Y", '"+y$', { desc = "Yank line to system clipboard" })
|
vim.keymap.set({ "n", "x" }, "<leader>Y", '"+y$', { desc = "Yank line to system clipboard" })
|
||||||
vim.keymap.set({ "n", "x" }, "<leader>p", '"+p', { desc = "Past from system clipboard" })
|
vim.keymap.set({ "n", "x" }, "<leader>p", '"+p', { desc = "Past from system clipboard" })
|
||||||
vim.keymap.set({ "n", "x" }, "<leader>P", '"+P', { desc = "Past line from system clipboard" })
|
vim.keymap.set({ "n", "x" }, "<leader>P", '"+P', { desc = "Past line from system clipboard" })
|
||||||
|
|
||||||
-- use osc52 so it works in ssh sessions
|
-- use osc52 so it works in ssh sessions
|
||||||
vim.g.clipboard = {
|
-- see https://github.com/tmux/tmux/issues/4048 for more info
|
||||||
name = "OSC 52",
|
|
||||||
copy = {
|
if vim.env.TMUX ~= nil then
|
||||||
["+"] = require("vim.ui.clipboard.osc52").copy("+"),
|
-- tmux osc52 is lame, we need to run `tmux refresh-client -l` before copying
|
||||||
["*"] = require("vim.ui.clipboard.osc52").copy("*"),
|
-- vim.g.clipboard = {
|
||||||
},
|
-- name = "tmux",
|
||||||
paste = {
|
-- copy = {
|
||||||
["+"] = require("vim.ui.clipboard.osc52").paste("+"),
|
-- ["+"] = { "tmux", "load-buffer", "-w", "-" },
|
||||||
["*"] = require("vim.ui.clipboard.osc52").paste("*"),
|
-- ["*"] = { "tmux", "load-buffer", "-w", "-" },
|
||||||
},
|
-- },
|
||||||
}
|
-- paste = {
|
||||||
|
-- ["+"] = { "bash", "-c", "tmux refresh-client -l && sleep 0.05 && tmux save-buffer -" },
|
||||||
|
-- ["*"] = { "bash", "-c", "tmux refresh-client -l && sleep 0.05 && tmux save-buffer -" },
|
||||||
|
-- },
|
||||||
|
-- cache_enabled = 0,
|
||||||
|
-- }
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Quickfix list
|
-- Quickfix list
|
||||||
|
|||||||
Reference in New Issue
Block a user