clipboard

This commit is contained in:
Christian Nieves
2023-09-15 17:43:45 +00:00
parent 31f07ddc5e
commit d8414570a1
3 changed files with 26 additions and 24 deletions

View File

@ -31,19 +31,16 @@ set-option -g base-index 1
set-window-option -g pane-base-index 1
# enable OSC 52 clipboard
set -as terminal-overrides ',tmux*:Ms=\\E]52;%p1%s;%p2%s\\007'
set -as terminal-overrides ',screen*:Ms=\\E]52;%p1%s;%p2%s\\007'
set -s set-clipboard on
# set -as terminal-overrides ',tmux*:Ms=\\E]52;%p1%s;%p2%s\\007'
# set -as terminal-overrides ',screen*:Ms=\\E]52;%p1%s;%p2%s\\007'
set -g @thumbs-osc52 '1'
# tmux-256color instead of screen-256color enables italics
set -g default-terminal "tmux-256color"
# Tc enables true color
set -ag terminal-overrides ",*256col*:colors=256:Tc"
set -as terminal-features ',rxvt-unicode-256color:clipboard'
set -g allow-passthrough on
# set -ag terminal-overrides ",*256col*:colors=256:Tc"
# set -as terminal-features ',rxvt-unicode-256color:clipboard'
# set -g default-shell zsh
# force a reload of the config file
@ -65,20 +62,32 @@ set-window-option -g xterm-keys on
set-option -g xterm-keys on
set -g status-keys vi
set-window-option -g allow-passthrough on
set -s set-clipboard on
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
# bind-key -T copy-mode-vi y send-keys -X copy-pipe 'yank > #{pane_tty}'
# transfer copied text to attached terminal with yank
bind-key -T copy-mode-vi y send-keys -X copy-pipe 'yank > #{pane_tty}'
bind-key -T copy-mode-vi Y send-keys -X copy-pipe 'yank > #{pane_tty}'
# transfer most-recently copied text to attached terminal with yank
bind-key -n M-y run-shell 'tmux save-buffer - | yank > #{pane_tty}'
# transfer previously copied text (chosen from a menu) to attached terminal
bind-key -n M-Y choose-buffer 'run-shell "tmux save-buffer -b \"%%%\" - | yank > #{pane_tty}"'
# allowd pane-navigation while in copy-mode
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
# # transfer copied text to attached terminal with yank
# bind-key -T copy-mode-vi Y send-keys -X copy-pipe 'yank > #{pane_tty}'
# Bind ']' to use pbpaste
#bind ] run "pbpaste | tmux load-buffer - && tmux paste-buffer"
setw -g monitor-activity on
bind-key v split-window -h -c '#{pane_current_path}'
@ -99,12 +108,6 @@ bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq v
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
# allowd pane-navigation while in copy-mode
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window

View File

@ -9,11 +9,11 @@ return {
return { vim.fn.split(vim.fn.getreg(""), "\n"), vim.fn.getregtype("") }
end
-- vim.g.clipboard = {
-- name = "osc52",
-- copy = { ["+"] = copy, ["*"] = copy },
-- paste = { ["+"] = paste, ["*"] = paste },
-- }
vim.g.clipboard = {
name = "osc52",
copy = { ["+"] = copy, ["*"] = copy },
paste = { ["+"] = paste, ["*"] = paste },
}
-- Now the '+' register will copy to system clipboard using OSC52
vim.keymap.set("n", "<leader>y", '"+y')

View File

@ -172,7 +172,6 @@ function! s:AddBufferToTab()
tabfirst
endfun
filetype plugin indent on
syntax on