diff options
author | Martin Fischer <martin@push-f.com> | 2025-06-16 17:30:51 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2025-06-18 21:00:46 +0200 |
commit | c8c85adc361d48d770fc5a5da86d06cd5809951f (patch) | |
tree | e01850bccee2902c5817ea0f3bd28ce1e6a549c0 | |
parent | f2a1ac7744b95f8913a46dd5b535bfcb4cf1a06f (diff) |
fix(workstation): make vim use system clipboard
-rw-r--r-- | nixos/profiles/common/basics.nix | 3 | ||||
-rw-r--r-- | nixos/profiles/workstation/default.nix | 2 | ||||
-rw-r--r-- | user/vim/vimrc | 16 |
3 files changed, 20 insertions, 1 deletions
diff --git a/nixos/profiles/common/basics.nix b/nixos/profiles/common/basics.nix index aa6eff9..4ef0c14 100644 --- a/nixos/profiles/common/basics.nix +++ b/nixos/profiles/common/basics.nix @@ -3,7 +3,8 @@ { environment.systemPackages = with pkgs; [ git - vim + # lowPrio because we use vim-full in the workstation profile + (lowPrio vim) file htop diff --git a/nixos/profiles/workstation/default.nix b/nixos/profiles/workstation/default.nix index 23c1412..ec84c94 100644 --- a/nixos/profiles/workstation/default.nix +++ b/nixos/profiles/workstation/default.nix @@ -39,6 +39,8 @@ in npins (callPackage "${sources.agenix}/pkgs/agenix.nix" {}) + vim-full + unzip # Android diff --git a/user/vim/vimrc b/user/vim/vimrc index 8c85c4e..952f863 100644 --- a/user/vim/vimrc +++ b/user/vim/vimrc @@ -3,5 +3,21 @@ syntax on " Don't break words in the middle. set linebreak +" Enable easy copying between different vim instances. +set clipboard=unnamed + +" Wayland clipboard workaround (see https://github.com/vim/vim/issues/5157). +if !empty($WAYLAND_DISPLAY) && executable('wl-copy') && executable('wl-paste') + " enable focus reporting + let &t_fe = "\<Esc>[?1004h" + let &t_fd = "\<Esc>[?1004l" + + augroup wl-clipboard + autocmd! + autocmd FocusLost * if @" != '' | call system('wl-copy --trim-newline', @") | endif + autocmd FocusGained * let @" = system('wl-paste -n') + augroup END +endif + " Enable pasting with middle mouse click in insert mode. set mouse= |