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