Add new leader command gs for tig

Of course you have to have tig installed.

Inside tig you can manage common git tasks like staging and commiting
This commit is contained in:
secretspecter 2024-03-09 11:15:57 -07:00
parent 64bcb8e231
commit 682bdbb680

View file

@ -1,5 +1,6 @@
(let [cmp (require :cmp) (let [cmp (require :cmp)
luasnip (require :luasnip)] luasnip (require :luasnip)]
{:options (fn [] {:options (fn []
(set vim.g.mapleader " ") (set vim.g.mapleader " ")
(set vim.g.maplocalleader "\\") (set vim.g.maplocalleader "\\")
@ -13,41 +14,52 @@
(set vim.o.splitbelow true) (set vim.o.splitbelow true)
(set vim.o.splitright true) (set vim.o.splitright true)
(set vim.opt.swapfile false)) (set vim.opt.swapfile false))
:keymap (fn [] :keymap (fn []
(let [nmap #(vim.keymap.set :n $1 $2 {:desc $3}) (let [nmap #(vim.keymap.set :n $1 $2 {:desc $3})
tmap #(vim.keymap.set :t $1 $2)] tmap #(vim.keymap.set :t $1 $2)]
(nmap :<Tab> :<C-^> "Toggle alternate-file") (nmap :<Tab> :<C-^> "Toggle alternate-file")
(nmap :<C-x> ":bn|bd!#<cr>" "Delete a buffer without removing the split") (nmap :<C-x> ":bn|bd!#<cr>" "Delete a buffer without removing the split")
(nmap :<leader>w :80<C-W>|) (nmap :<leader>to ":new term://bash|resize 8<cr>" "Open an 8 line terminal below the current window")
(nmap :<C-h> :<C-W>h) (nmap :<leader>w :80<C-W>| "Set the window width to 80 characters")
(nmap :<C-j> :<C-W>j) (nmap :<C-t> :tabnew "Create a new tab page")
(nmap :<C-k> :<C-W>k)
(nmap :<C-l> :<C-W>l) (nmap :<C-h> :<C-W>h "Move to window left")
(tmap :<C-h> :<C-\><C-n><C-w>h) (nmap :<C-j> :<C-W>j "Move to window down")
(tmap :<C-j> :<C-\><C-n><C-w>j) (nmap :<C-k> :<C-W>k "Move to window up")
(tmap :<C-k> :<C-\><C-n><C-w>k) (nmap :<C-l> :<C-W>l "Move to window right")
(tmap :<C-l> :<C-\><C-n><C-w>l) (tmap :<C-h> :<C-\><C-n><C-w>h "Move to window left (from a terminal)")
(tmap :<C-w> "<C-\\><C-n>") (tmap :<C-j> :<C-\><C-n><C-w>j "Move to window down (from a terminal)")
(nmap :<leader>to ":new term://bash|resize 8<cr>") (tmap :<C-k> :<C-\><C-n><C-w>k "Move to window up (from a terminal)")
(tmap :<C-l> :<C-\><C-n><C-w>l "Move to window right (from a terminal)")
(tmap :<C-w> "<C-\\><C-n>" "Escape to normal mode from a terminal")
(vim.api.nvim_create_autocmd (vim.api.nvim_create_autocmd
[:BufWinEnter :WinEnter] [:BufWinEnter :WinEnter]
{:pattern "term://*" {:pattern "term://*"
:command "startinsert"}) :command "startinsert"}) ;; Start terminals in insert mode
(nmap :<leader>dj
(nmap :<leader>jt
#(vim.cmd (.. "vsplit ~/TDC-Obsidian/Journal/" #(vim.cmd (.. "vsplit ~/TDC-Obsidian/Journal/"
(os.date "%Y") "/" (os.date "%Y") "/"
(os.date "%m") "/" (os.date "%m") "/"
(os.date "%Y-%m-%d") (os.date "%Y-%m-%d")
".md") ".md"
"|$")
"Open today's journal")) "Open today's journal"))
(nmap :<leader>o ":Telescope find_files<cr>" "Telescope find_files")
(nmap :<leader>b ":Telescope buffers<cr>" "Telescope buffers") (nmap :<leader>o ":Telescope find_files<cr>" "Search filenames in :pwd")
(nmap :<leader>s ":Telescope live_grep<cr>" "Telescope live_grep") (nmap :<leader>b ":Telescope buffers<cr>" "Search open buffers")
(nmap :<leader>e ":Telescope emoji<cr>" "Telescope emoji") (nmap :<leader>s ":Telescope live_grep<cr>" "Search current buffer")
(nmap :<leader>e ":Telescope emoji<cr>" "Search for an emoji to copy to clipboard")
(nmap :<leader>gs ":vsplit term://tig<cr>")
(nmap :<leader>gc ":vsplit term://git commit<cr>")
(let [duck (require :duck)] (let [duck (require :duck)]
(nmap :<leader><leader> #(duck.hatch) "hatch a duck") (nmap :<leader><leader> #(duck.hatch) "hatch a duck")
(nmap :<leader>dk #(duck.cook) "cook a duck")) (nmap :<leader>dk #(duck.cook) "cook a duck"))))
))
:treesitter-languages [:c :treesitter-languages [:c
:lua :lua
:vim :vim
@ -55,6 +67,7 @@
:query :query
:fennel :fennel
:racket] :racket]
:language-servers {:lua_ls {:filetypes [:lua] :language-servers {:lua_ls {:filetypes [:lua]
:Lua {:workspace {:checkThirdParty false}} :Lua {:workspace {:checkThirdParty false}}
:telemetry {:enable false} :telemetry {:enable false}
@ -64,6 +77,7 @@
:diagnostics {:globals [:vim]}}} :diagnostics {:globals [:vim]}}}
:bashls {:filetypes [:bash]} :bashls {:filetypes [:bash]}
:marksman {:filetypes [:markdown]}} :marksman {:filetypes [:markdown]}}
:lsp-attach (fn [_ bufnr] :lsp-attach (fn [_ bufnr]
(let [nmap #(vim.keymap.set :n $1 $2 (let [nmap #(vim.keymap.set :n $1 $2
{:buffer bufnr {:buffer bufnr
@ -73,6 +87,7 @@
(nmap :gr telescope.lsp_references "[G]o to [R]eferences") (nmap :gr telescope.lsp_references "[G]o to [R]eferences")
(nmap :gI vim.lsp.buf.implementation (nmap :gI vim.lsp.buf.implementation
"[G]o to [I]mplementation"))) "[G]o to [I]mplementation")))
:cmp-mapping {:<C-j> (cmp.mapping.select_next_item) :cmp-mapping {:<C-j> (cmp.mapping.select_next_item)
:<C-k> (cmp.mapping.select_prev_item) :<C-k> (cmp.mapping.select_prev_item)
:<C-d> (cmp.mapping.scroll_docs -4) :<C-d> (cmp.mapping.scroll_docs -4)