diff options
| author | Mike Vink <ivi@vinkies.net> | 2024-09-05 18:23:03 +0200 |
|---|---|---|
| committer | Mike Vink <ivi@vinkies.net> | 2024-09-05 18:23:03 +0200 |
| commit | b5b710f2b455fe65e77e66934263e19627c79b95 (patch) | |
| tree | b57f4d224b2cec947b13b348ffae468b5ba8aa35 | |
| parent | b89f42a3ac8d42da4c5ce4340c33a759dc703a4a (diff) | |
finish GBrowse
| -rw-r--r-- | mut/neovim/fnl/conf/init.fnl | 68 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/pkgs/lint.fnl | 3 | ||||
| -rw-r--r-- | profiles/core/neovim.nix | 6 |
3 files changed, 67 insertions, 10 deletions
diff --git a/mut/neovim/fnl/conf/init.fnl b/mut/neovim/fnl/conf/init.fnl index 8a15c18..0cf54e6 100644 --- a/mut/neovim/fnl/conf/init.fnl +++ b/mut/neovim/fnl/conf/init.fnl @@ -81,6 +81,7 @@ (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 :gb ":GBrowse<CR>") (map :n :ga "<Plug>(EasyAlign)") (map :x :ga "<Plug>(EasyAlign)") (map :n :<leader>d<cr> (fn [] (draw true))) @@ -289,17 +290,76 @@ : remote_name : repo : type } data) + + (local + oilpath + (case (vim.fn.bufname "%") + (where oilbuf (vim.startswith oilbuf "oil://")) + (do + (local d (.. "oil://" (vim.fs.dirname git_dir) "/")) + (oilbuf:sub (+ 1 (d:len)) (oilbuf:len))) + _ + "")) + (local [home repo] (case remote (where s (vim.startswith s "git@")) - (case [(s:match "(git@)([^:]+):(.*)(%.git)")] - ["git@" home repo ".git"] [home repo] - _ []))) + (do + (or + (case [(s:match "(git@)([^:]+):(.*)(%.git)")] + ["git@" home repo ".git"] + [home repo]) + (case [(s:match "(git@)([^:]+):.*/(.*)/(.*)/(.*)")] + ["git@" home org project repo] + [(home:gsub "ssh%." "") [(.. org "/" project) repo]]))))) + + (P home repo) (case [home repo] + (where ["bitbucket.org" repo]) + (do + (case [path type] + ["" "tree"] + (.. "https://" home "/" repo "/src/" commit "/" (or oilpath path "")) + [path "blob"] + (.. "https://" home "/" repo "/src/" commit "/" path) + [path "commit"] + (.. "https://" home "/" repo "/commits/" commit) + [path "ref"] + (.. "https://" home "/" repo "/commits/" commit))) + (where ["dev.azure.com" [org repo]]) + (do + (case [path type] + ["" "tree"] + (.. "https://" home "/" org "/_git/" repo "?version=GB" commit "&path=/" (or oilpath path "")) + [path "blob"] + (.. "https://" home "/" org "/_git/" repo "?version=GB" commit "&path=/" path) + [path "commit"] + (.. "https://" home "/" org "/_git/" repo "/commit/" commit) + [path "ref"] + (.. "https://" home "/" org "/_git/" repo "/commit/" commit))) + (where ["gitlab.com" repo]) + (do + (case [path type] + ["" "tree"] + (.. "https://" home "/" repo "/-/tree/" commit "/" (or oilpath "")) + [path "commit"] + (.. "https://" home "/" repo "/-/commit/" commit) + [path "ref"] + (.. "https://" home "/" repo "/-/commit/" commit) + [path "blob"] + (.. "https://" home "/" repo "/-/blob/" commit "/" path))) (where ["github.com" repo]) (do - (.. "https://" home "/" repo "/commit/" commit)))) + (case [path type] + ["" "tree"] + (.. "https://" home "/" repo "/tree/" commit "/" (or oilpath "")) + [path "commit"] + (.. "https://" home "/" repo "/commit/" commit) + [path "ref"] + (.. "https://" home "/" repo "/commit/" commit) + [path "blob"] + (.. "https://" home "/" repo "/blob/" commit "/" path))))) (vim.api.nvim_create_user_command :Browse diff --git a/mut/neovim/fnl/conf/pkgs/lint.fnl b/mut/neovim/fnl/conf/pkgs/lint.fnl index 3d92c8b..ffd517b 100644 --- a/mut/neovim/fnl/conf/pkgs/lint.fnl +++ b/mut/neovim/fnl/conf/pkgs/lint.fnl @@ -15,7 +15,8 @@ (conform.setup {:formatters_by_ft {:python [:ruff_format :isort] - :go [:goimports]} + :go [:goimports] + :terraform [:terraform_fmt]} :format_on_save {:timeout_ms 500 :lsp_fallback false}}) diff --git a/profiles/core/neovim.nix b/profiles/core/neovim.nix index 6db247c..d59d81f 100644 --- a/profiles/core/neovim.nix +++ b/profiles/core/neovim.nix @@ -17,11 +17,7 @@ trim_trailing_whitespace = true; insert_final_newline = true; }; - "*.yaml" = { - indent_style = "space"; - indent_size = 2; - }; - "*.nix" = { + "*.{yaml,nix,sh}" = { indent_style = "space"; indent_size = 2; }; |
