diff options
| author | Mike Vink <ivi@vinkies.net> | 2024-09-05 11:47:27 +0200 |
|---|---|---|
| committer | Mike Vink <ivi@vinkies.net> | 2024-09-05 11:47:27 +0200 |
| commit | b89f42a3ac8d42da4c5ce4340c33a759dc703a4a (patch) | |
| tree | 72e4f2d442eb76c8344628158decc16ef76c5e8a | |
| parent | de034b4197adf5c768330dbd2c21e844762056fa (diff) | |
some tweaks to make copying better
| -rwxr-xr-x | mut/bin/maimpick | 20 | ||||
| -rwxr-xr-x | mut/bin/passmenu | 2 | ||||
| -rw-r--r-- | mut/dwm/config.h | 2 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/init.fnl | 95 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/pkgs/oil.fnl | 11 | ||||
| -rw-r--r-- | mut/st/config.h | 2 | ||||
| -rw-r--r-- | profiles/core/home.nix | 2 | ||||
| -rw-r--r-- | profiles/core/neovim.nix | 1 | ||||
| -rw-r--r-- | profiles/graphical/suckless.nix | 1 |
9 files changed, 102 insertions, 34 deletions
diff --git a/mut/bin/maimpick b/mut/bin/maimpick index 5de26c1..00a0c98 100755 --- a/mut/bin/maimpick +++ b/mut/bin/maimpick @@ -6,13 +6,17 @@ # variables output="$(date '+%y%m%d-%H%M-%S').png" -xclip_cmd="xclip -sel clip -t image/png" +clip() { + xclip -f -t image/png | xclip -sel c -t image/png +} -case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | dmenu -l 6 -i -p "Screenshot which area?")" in - "a selected area") maim -u -s pic-selected-"${output}" ;; - "current window") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;; - "full screen") maim -q -d 0.2 pic-full-"${output}" ;; - "a selected area (copy)") maim -u -s | ${xclip_cmd} ;; - "current window (copy)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" | ${xclip_cmd} ;; - "full screen (copy)") maim -q -d 0.2 | ${xclip_cmd} ;; +case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (save)\\ncurrent window (save)\\nfull screen (save)" | dmenu -l 6 -i -p "Screenshot which area?")" in + "a selected area") maim -u -s | clip ;; + "current window") + echo "$(xdotool getactivewindow)" + maim -q -d 0.2 -i "$(xdotool getactivewindow)" | clip ;; + "full screen") maim -q -d 0.2 | clip ;; + "a selected area (save)") maim -u -s pic-selected-"${output}" ;; + "current window (save)") maim -q -d 0.2 -i "$(xdotool getactivewindow)" pic-window-"${output}" ;; + "full screen (save)") maim -q -d 0.2 pic-full-"${output}" ;; esac diff --git a/mut/bin/passmenu b/mut/bin/passmenu index 1af4a02..345c0ae 100755 --- a/mut/bin/passmenu +++ b/mut/bin/passmenu @@ -20,6 +20,6 @@ fi [[ -n $password ]] || exit - pass show -c "$password" + pass show "$password" | head -n1 | xclip -f | xclip -f -sel c ) >/tmp/debug 2>&1 diff --git a/mut/dwm/config.h b/mut/dwm/config.h index e0171e7..374654a 100644 --- a/mut/dwm/config.h +++ b/mut/dwm/config.h @@ -254,7 +254,7 @@ static const Key keys[] = { { MODKEY, XK_space, zoom, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { 0, XK_Print, spawn, SHCMD("maim pic-full-$(date '+%y%m%d-%H%M-%S').png") }, + { 0, XK_Print, spawn, SHCMD("maim -q -d 0.2 -i \"$(xdotool getactivewindow)\" | xclip -f -t image/png | xclip -sel c -t image/png ") }, { ShiftMask, XK_Print, spawn, {.v = (const char*[]){ "maimpick", NULL } } }, { MODKEY, XK_Print, spawn, {.v = (const char*[]){ "dmenurecord", NULL } } }, { MODKEY|ShiftMask, XK_Print, spawn, {.v = (const char*[]){ "dmenurecord", "kill", NULL } } }, diff --git a/mut/neovim/fnl/conf/init.fnl b/mut/neovim/fnl/conf/init.fnl index 3a38d4e..8a15c18 100644 --- a/mut/neovim/fnl/conf/init.fnl +++ b/mut/neovim/fnl/conf/init.fnl @@ -10,7 +10,25 @@ (vim.cmd "highlight WinSeparator guibg=None") (vim.cmd "packadd cfilter") -(vim.opt.clipboard:append [:unnamedplus]) +(vim.opt.clipboard:append ["unnamedplus"]) + +(local osc52 (require :vim.ui.clipboard.osc52)) +(let + [paste + (fn [] [(vim.fn.split (vim.fn.getreg "") "\n") (vim.fn.getregtype "")]) + xclip + (fn [lines] + (vim.system [:xclip] {:text true :stdin lines} (fn [exitobj])) + (vim.system [:xclip :-selection :clipboard] {:text true :stdin lines} (fn [exitobj])) + nil)] + (set + vim.g.clipboard + {:name "OSC 52" + :copy {:+ xclip + :* xclip} + :paste {:+ paste + :* paste}})) + (tset _G :P (lambda [...] (let [inspected (icollect [_ v (ipairs [...])] @@ -23,24 +41,24 @@ (fzf.setup [:max-perf]) (local - draw - (fn [toggle] - (if - toggle - (do - (vim.cmd "set virtualedit=all") - (vim.keymap.set :v "<leader>;" "<esc>:VBox<CR>") - (vim.keymap.set "n" "J" "<C-v>j:VBox<CR>") - (vim.keymap.set "n" "K" "<C-v>k:VBox<CR>") - (vim.keymap.set "n" "L" "<C-v>l:VBox<CR>") - (vim.keymap.set "n" "H" "<C-v>h:VBox<CR>")) - (do - (vim.cmd "set virtualedit=") - (vim.keymap.del :v "<leader>;") - (vim.keymap.del "n" "J") - (vim.keymap.del "n" "K") - (vim.keymap.del "n" "L") - (vim.keymap.del "n" "H"))))) + draw + (fn [toggle] + (if + toggle + (do + (vim.cmd "set virtualedit=all") + (vim.keymap.set :v "<leader>;" "<esc>:VBox<CR>") + (vim.keymap.set "n" "J" "<C-v>j:VBox<CR>") + (vim.keymap.set "n" "K" "<C-v>k:VBox<CR>") + (vim.keymap.set "n" "L" "<C-v>l:VBox<CR>") + (vim.keymap.set "n" "H" "<C-v>h:VBox<CR>")) + (do + (vim.cmd "set virtualedit=") + (vim.keymap.del :v "<leader>;") + (vim.keymap.del "n" "J") + (vim.keymap.del "n" "K") + (vim.keymap.del "n" "L") + (vim.keymap.del "n" "H"))))) (local commenter (require :nvim_comment)) (commenter.setup) @@ -69,7 +87,6 @@ (map :n :<leader>d<bs> (fn [] (draw false))) (map :n :- ::Oil<cr>) (map :n :_ #(oil.open_cwd.callback)) - (map :v :y "<Plug>OSCYankVisual|gvy") (map :n :<leader>qf cope) (map :n :<leader>q<BS> ":cclose<cr>") (map :n :<leader>ll ":lopen<cr>") @@ -104,6 +121,7 @@ (map :n "]x" ":lnext<cr>") (map :n "[g" ":GV<cr>") (map :n "]g" ":GV?<cr>") + (map :n "]G" ":GV!<cr>") (map :n :<leader>xp #(fzf.files)) (map :n "<leader>:" #(i-grep "<c-r><c-w>" (vim.fn.bufname "%"))) (map :v "<leader>:" ":Vgrep!<cr>") @@ -148,7 +166,7 @@ (vim.api.nvim_create_user_command :NixEdit (fn [{: args}] - (local f (io.popen (.. "nix eval --raw " vim.env.HOME "/flake#nixosConfigurations." (vim.fn.hostname) ".pkgs." args))) + (local f (io.popen (.. "nix eval --raw /nix-config#nixosConfigurations." (vim.fn.hostname) ".pkgs." args))) (vim.cmd (.. "e " (f:read)))) {:nargs 1}) @@ -255,3 +273,38 @@ (set last_job_thunk thunk) (thunk)))) {:nargs :* :bang true :complete :shellcmd}) + + + +(fn browse_git_remote + [data] + (P data) + (local + {: commit + : git_dir + : line1 + : line2 + : path + : remote + : remote_name + : repo + : type } data) + (local [home repo] + (case remote + (where s (vim.startswith s "git@")) + (case [(s:match "(git@)([^:]+):(.*)(%.git)")] + ["git@" home repo ".git"] [home repo] + _ []))) + + (case [home repo] + (where ["github.com" repo]) + (do + (.. "https://" home "/" repo "/commit/" commit)))) + +(vim.api.nvim_create_user_command + :Browse + (fn [{: args}] (vim.system ["xdg-open" args] {} (fn []))) + {:nargs 1}) + +(set vim.g.fugitive_browse_handlers + [browse_git_remote]) diff --git a/mut/neovim/fnl/conf/pkgs/oil.fnl b/mut/neovim/fnl/conf/pkgs/oil.fnl index 284b8bd..7d9959e 100644 --- a/mut/neovim/fnl/conf/pkgs/oil.fnl +++ b/mut/neovim/fnl/conf/pkgs/oil.fnl @@ -20,7 +20,16 @@ { "g?" "actions.show_help" "<CR>" "actions.select" - "<C-s>" "actions.select_vsplit" + "<C-s>" + #(do + (vim.api.nvim_feedkeys + (vim.api.nvim_replace_termcodes + ":Sh<up><c-f>" true false true) + :n false) + (vim.schedule #(do + (vim.cmd "let v:searchforward = 0") + (vim.keymap.set :n :/ "/Sh.*" {:buffer true}) + (vim.keymap.set :n :? "?Sh.*" {:buffer true})))) "<C-h>" "actions.select_split" "<C-t>" "actions.select_tab" "<C-p>" #(fzf.files) diff --git a/mut/st/config.h b/mut/st/config.h index 0fbbdc0..d89d07a 100644 --- a/mut/st/config.h +++ b/mut/st/config.h @@ -5,7 +5,7 @@ * * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html */ -static char *font = "mono:pixelsize=16:antialias=true:autohint=true"; +static char *font = "JetBrainsMonoNLNerdFontMono:pixelsize=16:antialias=true:autohint=true"; static char *font2[] = { "NotoColorEmoji:pixelsize=14:antialias=true:autohint=true" }; static int borderpx = 2; diff --git a/profiles/core/home.nix b/profiles/core/home.nix index d4be8eb..f52f8a6 100644 --- a/profiles/core/home.nix +++ b/profiles/core/home.nix @@ -236,6 +236,8 @@ ssh-add -l > /dev/null || ssh-add ~/.ssh/id_ed25519_sk ''; shellAliases = { + t = "terraform "; + c = "xclip -f | xclip -sel c -f "; open = "xdg-open "; k9s = "k9s "; k = "kubectl "; diff --git a/profiles/core/neovim.nix b/profiles/core/neovim.nix index a622026..6db247c 100644 --- a/profiles/core/neovim.nix +++ b/profiles/core/neovim.nix @@ -60,7 +60,6 @@ # external oil-nvim vim-fugitive - vim-oscyank venn-nvim gv-vim zoxide-vim diff --git a/profiles/graphical/suckless.nix b/profiles/graphical/suckless.nix index 58f518d..1144b7b 100644 --- a/profiles/graphical/suckless.nix +++ b/profiles/graphical/suckless.nix @@ -79,6 +79,7 @@ dmenu librewolf xclip + xdotool maim asciinema asciinema-agg |
