diff options
| author | Mike Vink <mike@pionative.com> | 2024-04-16 17:01:55 +0200 |
|---|---|---|
| committer | Mike Vink <mike@pionative.com> | 2024-04-16 17:01:55 +0200 |
| commit | 985cac44e0c7b33763d0f9d26842ad5325a4a303 (patch) | |
| tree | 8e0823fbdd2c4d1aa7b346bd8ad1dff70918d23c | |
| parent | d05d3476c1dbda8103b323b590252a974a714c9d (diff) | |
update
| -rw-r--r-- | machines/work.nix | 77 | ||||
| -rw-r--r-- | mut/bin/choose | 3 | ||||
| l--------- | mut/bin/hs | 1 | ||||
| -rwxr-xr-x | mut/bin/showkey | bin | 0 -> 51728 bytes | |||
| -rw-r--r-- | mut/neovim/fnl/conf/init.fnl | 36 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/pkgs/cmp.fnl | 18 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/pkgs/dap.fnl | 42 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/pkgs/lint.fnl | 8 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/pkgs/lualine.fnl | 11 | ||||
| -rw-r--r-- | overlays/treesitter.nix | 2 | ||||
| -rw-r--r-- | profiles/core/git.nix | 1 | ||||
| -rw-r--r-- | profiles/core/home.nix | 2 | ||||
| -rw-r--r-- | profiles/core/neovim.nix | 3 | ||||
| -rw-r--r-- | profiles/station/nonfree.nix | 1 |
14 files changed, 173 insertions, 32 deletions
diff --git a/machines/work.nix b/machines/work.nix index a68ba20..5196e91 100644 --- a/machines/work.nix +++ b/machines/work.nix @@ -44,6 +44,7 @@ pkgs.awscli2 pkgs.skhd pkgs.act + pkgs.yubikey-manager ]; hm = { home = { @@ -63,6 +64,7 @@ enableZshIntegration = true; }; extraConfig = '' + allow_remote_control yes cursor_shape block font_family JetBrainsMono Nerd Font Mono text_composition_strategy platform @@ -108,6 +110,7 @@ map kitty_mod+r load_config_file map cmd+c copy_to_clipboard map cmd+v paste_from_clipboard + map cmd+q quit ## name: Kanagawa ## license: MIT @@ -162,7 +165,6 @@ homebrew = { enable = true; brews = [ - "choose-gui" "pinentry-mac" ]; casks = [ @@ -170,6 +172,7 @@ ]; masApps = { tailscale = 1475387142; + slack = 803453959; }; }; services.syncthing = { @@ -193,7 +196,7 @@ services.skhd = { enable = true; skhdConfig = '' - cmd - 1 : osascript -e 'tell application "kitty" to activate' + cmd - 1 : osascript -e 'tell application "alacritty" to activate' cmd - 2 : osascript -e 'tell application "Google Chrome" to activate' cmd - 3 : osascript -e 'tell application "slack" to activate' cmd - 4 : osascript -e 'tell application "Microsoft Teams (work or school)" to activate' @@ -206,11 +209,33 @@ cmd - e : osascript -e 'tell application "mail" to activate' cmd - m : osascript -e 'tell application "Slack" to activate' cmd + shift - m : osascript -e 'tell application "Microsoft Teams (work or school)" to activate' - cmd - return : osascript -e 'tell application "kitty" to activate' + cmd - return : /Applications/Alacritty.app/Contents/MacOS/alacritty + cmd - d : ${pkgs.writers.writeBash "passautotype" '' + shopt -s nullglob globstar + + dmenu="/opt/homebrew/bin/dmenu-mac" + + ( + export PASSWORD_STORE_DIR="$HOME/sync/password-store" + prefix="$PASSWORD_STORE_DIR" + echo "prefix: $prefix" + password_files=( "$prefix"/**/*.gpg ) + password_files=( "''${password_files[@]#"$prefix"/}" ) + password_files=( "''${password_files[@]%.gpg}" ) + echo "password_files: ''${password_files[*]}" + + password="$(printf '%s\n' "''${password_files[@]}" | "$dmenu" "$@")" + echo "password: $password" + + [[ -n $password ]] || exit + + /Applications/Hammerspoon.app/Contents/Frameworks/hs/hs -c "hs.loadSpoon([[PassAutotype]]):autotype([[$password]])" + ) >/tmp/debug 2>&1 + ''} cmd + shift - d : ${pkgs.writers.writeBash "passmenu" '' shopt -s nullglob globstar - dmenu="/opt/homebrew/bin/choose" + dmenu="/opt/homebrew/bin/dmenu-mac" ( export PASSWORD_STORE_DIR="$HOME/sync/password-store" @@ -231,7 +256,51 @@ ''} ''; }; + services.yabai = { + enable = true; + package = pkgs.yabai; + enableScriptingAddition = true; + config = { + focus_follows_mouse = "autofocus"; + mouse_follows_focus = "off"; + window_placement = "first_child"; + window_opacity = "off"; + window_opacity_duration = "0.0"; + window_border = "on"; + window_border_placement = "inset"; + window_border_width = 2; + window_border_radius = 3; + active_window_border_topmost = "off"; + window_topmost = "on"; + window_shadow = "float"; + active_window_border_color = "0xff5c7e81"; + normal_window_border_color = "0xff505050"; + insert_window_border_color = "0xffd75f5f"; + active_window_opacity = "1.0"; + normal_window_opacity = "1.0"; + split_ratio = "0.50"; + auto_balance = "on"; + mouse_modifier = "fn"; + mouse_action1 = "move"; + mouse_action2 = "resize"; + layout = "bsp"; + window_origin_display = "focused"; + display_arrangement_order = "vertical"; + top_padding = 10; + bottom_padding = 10; + left_padding = 10; + right_padding = 10; + window_gap = 10; + }; + extraConfig = '' + # rules + yabai -m rule --add app='System Settings' manage=off + yabai -m rule --add app='kitty' title='dap' display='2' + + # Any other arbitrary config here + ''; + }; # Auto upgrade nix package and the daemon service. services.nix-daemon.enable = true; # nix.package = pkgs.nix; diff --git a/mut/bin/choose b/mut/bin/choose new file mode 100644 index 0000000..b6e5633 --- /dev/null +++ b/mut/bin/choose @@ -0,0 +1,3 @@ +#!/bin/bash +fifo_name="/tmp/choose" + diff --git a/mut/bin/hs b/mut/bin/hs new file mode 120000 index 0000000..c55f613 --- /dev/null +++ b/mut/bin/hs @@ -0,0 +1 @@ +/Applications/Hammerspoon.app/Contents/Frameworks/hs/hs
\ No newline at end of file diff --git a/mut/bin/showkey b/mut/bin/showkey Binary files differnew file mode 100755 index 0000000..9bb9a3b --- /dev/null +++ b/mut/bin/showkey diff --git a/mut/neovim/fnl/conf/init.fnl b/mut/neovim/fnl/conf/init.fnl index d183a5a..3e39450 100644 --- a/mut/neovim/fnl/conf/init.fnl +++ b/mut/neovim/fnl/conf/init.fnl @@ -1,14 +1,14 @@ -(vim.cmd "colorscheme kanagawa-wave") -(vim.cmd "filetype plugin on") -(vim.cmd "filetype indent on") -(vim.cmd "highlight WinSeparator guibg=None") -(vim.cmd "packadd cfilter") - (require :conf.settings) -(require :conf.pkgs) (require :conf.nix-develop) (require :conf.diagnostic) (require :conf.events) +(require :conf.pkgs) + +(vim.schedule #(vim.cmd "colorscheme kanagawa-wave")) +(vim.cmd "filetype plugin on") +(vim.cmd "filetype indent on") +(vim.cmd "highlight WinSeparator guibg=None") +(vim.cmd "packadd cfilter") (vim.opt.clipboard:append [:unnamedplus]) @@ -42,7 +42,7 @@ (vim.keymap.del "n" "L") (vim.keymap.del "n" "H"))))) -(local cope #(vim.cmd (.. ":copen " (math.floor (/ vim.o.lines 2.1))))) +(local cope #(vim.cmd (.. ":botright copen " (math.floor (/ vim.o.lines 2.1))))) (local oil (require :oil.actions)) (let [map vim.keymap.set] (map :n :<leader>d<cr> (fn [] (draw true))) @@ -55,9 +55,9 @@ (map :n :<leader>ll ":lopen<cr>") (map :n :<leader>l<BS> ":lclose<cr>") (map :n "<M-h>" cope) - (map :n "<M-j>" ":cnext<cr>") - (map :n "<M-k>" ":cprev<cr>") - (map :n :<M-l> ":Recompile<CR>") + (map :n "<C-n>" ":cnext<cr>") + (map :n "<C-p>" ":cprev<cr>") + (map :n :<C-a> ":Recompile<CR>") (map :n :<C-s> #(do (vim.api.nvim_feedkeys @@ -82,11 +82,21 @@ (map :n "]q" ":cnext<cr>") (map :n "[x" ":lprevious<cr>") (map :n "]x" ":lnext<cr>") - (map :n :<c-p> #(fzf.files)) (map :n :<leader>xp #(fzf.files)) - (map :n "<leader>;" ":silent grep ") + (map :n "<leader>;" #(do + (var keys "") + (if (not= (vim.opt_local.filetype:get) "oil") + (set keys (.. ":silent grep " (vim.fn.fnamemodify (vim.fn.bufname "%") ":h") "<c-f>B<left>i<space>")) + (do + (local f (vim.fn.bufname "%")) + (set keys (.. ":silent grep " (f:gsub "oil://" "") "<c-f>B<left>i<space>")))) + (vim.api.nvim_feedkeys + (vim.api.nvim_replace_termcodes + keys true false true) + :n false))) (map :n "<leader>'" ":silent args `fd `<left>") (map :n :<leader>xa #(fzf.args)) + (map :n "<leader>x;" #(fzf.quickfix)) (map :n :<leader>xb #(fzf.buffers {:keymap {:fzf {"alt-a" "toggle-all"}} :actions {:default {:fn action.buf_edit_or_qf}}})) diff --git a/mut/neovim/fnl/conf/pkgs/cmp.fnl b/mut/neovim/fnl/conf/pkgs/cmp.fnl index a60ee02..b219d39 100644 --- a/mut/neovim/fnl/conf/pkgs/cmp.fnl +++ b/mut/neovim/fnl/conf/pkgs/cmp.fnl @@ -8,7 +8,7 @@ (and (not= col 0) (= is_string nil))) (fn edit? [line] - (not= nil (line:match "^ed?i?t? .*$"))) + (or (not= nil (line:match "^.* %.?.*$")) (not= nil (line:match "^ed?i?t? .*$")))) (fn endswith? [line char] (not= nil (line:match (.. ".*" char "$")))) @@ -60,22 +60,23 @@ ; todo sorting based on least recently used (cmp.setup.cmdline ":" - {:enabled (fn [] (local val (edit? (vim.fn.getcmdline))) - (if (not val) - (cmp.close)) - val) + {:enabled (fn [] + (local val (edit? (vim.fn.getcmdline))) + (if (not val) + (cmp.close)) + val) :completion {:completeopt "menu,menuone,noinsert"} :mapping {:<C-n> (cmp.mapping (fn [fallback] (if (cmp.visible) (cmp.select_next_item) - (fallback))) + (cmp.complete))) [:i :c]) :<C-p> (cmp.mapping (fn [fallback] (if (cmp.visible) (cmp.select_prev_item) - (fallback))) + (cmp.complete))) [:i :c]) :<BS> (cmp.mapping (fn [fallback] @@ -102,8 +103,7 @@ (do (vim.schedule fallback)))))) [:i :c])} - :sources (cmp.config.sources - [{:name :cmdline :trigger_characters []} {:name :path}])} + :sources (cmp.config.sources [{:name :path}])} diff --git a/mut/neovim/fnl/conf/pkgs/dap.fnl b/mut/neovim/fnl/conf/pkgs/dap.fnl index 65f01c4..55988f6 100644 --- a/mut/neovim/fnl/conf/pkgs/dap.fnl +++ b/mut/neovim/fnl/conf/pkgs/dap.fnl @@ -41,11 +41,47 @@ :env {:CGO_CFLAGS :-Wno-error=cpp} :program "${fileDirname}"}]) -(dapui.setup {:expand_lines false}) -(dap-py.setup) +(set dap.defaults.fallback.external_terminal + {:command :/Applications/Alacritty.app/Contents/MacOS/alacritty + :args [:-T :dap :-e]}); + + +(dapui.setup + {:expand_lines false + :layouts + [{:position :bottom :size 10 :elements [{:id :repl :size 0.5} {:id :console :size 0.5}]} + {:position :left :size 40 :elements [{:id :breakpoints :size 0.25} {:id :stacks :size 0.25} {:id :watches :size 0.25} {:id :scopes :size 0.25}]} + {:position :bottom :size 25 :elements [{:id :repl :size 0.35} {:id :watches :size 0.65}]}]}) +(dap-py.setup nil {:console :externalTerminal}) +(tset (. configurations.python 1) :waitOnNormalExit true) +(tset (. configurations.python 1) :waitOnAbnormalExit true) + +(local run_table + {:python + (fn [fname] + { + :name (.. "Launch " fname) + :program fname + :console "externalTerminal" + :request "launch" + :type "python" + :waitOnAbnormalExit true + :waitOnNormalExit true})}) + +(vim.keymap.set + :n + "s;" + (fn [] + (local fname (vim.fn.fnamemodify (vim.fn.bufname "%") ":p")) + (local get_config (. run_table (vim.opt_local.ft:get))) + (if get_config + (dap.run (get_config fname))))) + (vim.keymap.set :n :si (lambda [] - (dapui.toggle {:reset true})) {:silent true}) + (dapui.toggle {:layout 1 :reset true}) + (dapui.toggle {:layout 2 :reset true})) {:silent true}) +(vim.keymap.set :n :s<enter> #(dapui.toggle {:layout 3 :reset true}) {:silent true}) ;; "breakpoints", ;; "repl", ;; "scopes", diff --git a/mut/neovim/fnl/conf/pkgs/lint.fnl b/mut/neovim/fnl/conf/pkgs/lint.fnl index 3125103..1814025 100644 --- a/mut/neovim/fnl/conf/pkgs/lint.fnl +++ b/mut/neovim/fnl/conf/pkgs/lint.fnl @@ -2,5 +2,13 @@ (set lint.linters_by_ft {:markdown [:vale] + :python [:ruff] :sh [:shellcheck]}) +(local conform (require :conform)) +(conform.setup + {:formatters_by_ft + {:python [:ruff_format :isort]} + :format_on_save + {:timeout_ms 500 + :lsp_fallback false}}) diff --git a/mut/neovim/fnl/conf/pkgs/lualine.fnl b/mut/neovim/fnl/conf/pkgs/lualine.fnl index 6f2d66b..4f57425 100644 --- a/mut/neovim/fnl/conf/pkgs/lualine.fnl +++ b/mut/neovim/fnl/conf/pkgs/lualine.fnl @@ -1,6 +1,15 @@ (local lualine (require :lualine)) +(local clients #(do + (local bn (vim.fn.fnamemodify (vim.fn.bufname :%) ::p)) + (local m (bn:match ".*clients/([a-z]+)/.*")) + (if (not= nil m) + m + ""))) (lualine.setup - {:winbar + {:extensions [:quickfix :fugitive :oil :fzf :nvim-dap-ui] + :sections + {:lualine_c ["%=" {1 clients :color :WarningMsg}]} + :winbar {:lualine_a [:filename]} :inactive_winbar {:lualine_a [:filename]} diff --git a/overlays/treesitter.nix b/overlays/treesitter.nix index cef45e8..35b75a0 100644 --- a/overlays/treesitter.nix +++ b/overlays/treesitter.nix @@ -1,4 +1,4 @@ -{mvinkioPkgs, ...}: (final: prev: { +{...}: (final: prev: { tree-sitter = mvinkioPkgs.tree-sitter; vimPlugins = prev.vimPlugins diff --git a/profiles/core/git.nix b/profiles/core/git.nix index baf2135..dee2d84 100644 --- a/profiles/core/git.nix +++ b/profiles/core/git.nix @@ -19,6 +19,7 @@ "/.envrc" "/.env" ".vimsession.vim" + "tfplan" ]; }; }; diff --git a/profiles/core/home.nix b/profiles/core/home.nix index c003fc0..5238800 100644 --- a/profiles/core/home.nix +++ b/profiles/core/home.nix @@ -136,6 +136,8 @@ bindkey -M menuselect 'k' vi-up-line-or-history bindkey -M menuselect 'l' vi-forward-char bindkey -M menuselect 'j' vi-down-line-or-history + bindkey -M menuselect 'n' vi-forward-blank-word + bindkey -M menuselect 'p' vi-backward-blank-word # Use lf to switch directories and bind it to ctrl-o diff --git a/profiles/core/neovim.nix b/profiles/core/neovim.nix index 86d4a78..0292b9a 100644 --- a/profiles/core/neovim.nix +++ b/profiles/core/neovim.nix @@ -78,6 +78,9 @@ luasnip vim-test nvim-lint + vim-surround + conform-nvim + trouble-nvim # cmp nvim-cmp diff --git a/profiles/station/nonfree.nix b/profiles/station/nonfree.nix index e9b9231..b323074 100644 --- a/profiles/station/nonfree.nix +++ b/profiles/station/nonfree.nix @@ -1,7 +1,6 @@ {pkgs, lib, ...}: with lib; { hm.home.packages = with pkgs; [ discord - slack ]; nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ |
