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 /mut | |
| parent | d05d3476c1dbda8103b323b590252a974a714c9d (diff) | |
update
Diffstat (limited to 'mut')
| -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 |
8 files changed, 93 insertions, 26 deletions
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]} |
