nvim-config/fnl/personalize.fnl

143 lines
6.8 KiB
Plaintext
Raw Normal View History

2023-07-29 15:21:07 +00:00
(let [cmp (require :cmp)
luasnip (require :luasnip)]
2023-07-29 15:21:07 +00:00
{:options (fn []
2023-08-04 18:18:59 +00:00
(set vim.g.mapleader " ")
2023-08-11 02:08:36 +00:00
(set vim.g.maplocalleader "\\")
2023-07-29 15:21:07 +00:00
(set vim.o.termguicolors true)
2024-03-16 05:39:18 +00:00
(set vim.opt.clipboard :unnamedplus)
2023-07-29 15:21:07 +00:00
(set vim.o.wrap false)
(set vim.opt.colorcolumn "80,120")
2024-03-16 05:39:18 +00:00
(vim.cmd.colorscheme :quiet)
2023-08-02 04:56:30 +00:00
(set vim.o.formatoptions :tncro)
2024-03-16 05:39:18 +00:00
(set vim.o.conceallevel 2) ;; 🤞 for anticonceal
(set vim.o.foldlevel 1)
2023-08-04 18:18:59 +00:00
(set vim.o.splitbelow true)
(set vim.o.splitright true)
2024-03-16 05:39:18 +00:00
(set vim.opt.swapfile false)
(set vim.g.sexp_filetypes "racket,fennel,scheme,lisp"))
2023-07-29 15:21:07 +00:00
:keymap (fn []
2023-08-04 18:18:59 +00:00
(let [nmap #(vim.keymap.set :n $1 $2 {:desc $3})
2024-03-09 21:33:39 +00:00
tmap #(vim.keymap.set :t $1 $2 {:desc (.. $3 " (from a terminal)")})]
2024-03-16 05:39:18 +00:00
(nmap :<C-h> :<C-W>h
"Move to window left")
(tmap :<C-h> :<C-\><C-n><C-w>h
"Move to window left")
(nmap :<C-j> :<C-W>j
"Move to window down")
(tmap :<C-j> :<C-\><C-n><C-w>j
"Move to window down")
(nmap :<C-k> :<C-W>k
"Move to window up")
(tmap :<C-k> :<C-\><C-n><C-w>k
"Move to window up")
(nmap :<C-l> :<C-W>l
"Move to window right")
(tmap :<C-l> :<C-\><C-n><C-w>l
"Move to window right")
(tmap :<C-w> "<C-\\><C-n>"
"Escape to normal mode")
2024-03-09 18:28:00 +00:00
2024-03-16 05:39:18 +00:00
(nmap :<C-x> ":bn|bd!#<cr>"
"Delete a buffer without removing the split")
(nmap :<leader>tt ":term<cr>i"
"Open a terminal in the current window")
(nmap :<leader>to ":new term://bash|resize 8<cr>"
"Open an 8 line terminal below the current window")
(nmap :<leader>w :80<C-W>|
"Set the window width to 80 characters")
(nmap :<leader>W :120<C-W>|
"Set the window width to 120 characters")
2024-03-16 05:39:18 +00:00
(nmap :<C-w>t ":tabnew<cr>"
"Create a new tab page")
(tmap :<C-w>t "<C-\\><C-n>:tabnew<cr>"
"Create a new tab page")
(nmap :<C-w><tab> :<C-w>gt
"Go to next tab (cyclical)")
(tmap :<C-w><tab> :<C-w>gt
"Go to next tab (cyclical)")
2024-03-16 05:39:18 +00:00
(nmap :<leader>oo ":tcd ~/TDC-Obsidian/|edit WIP.md<cr>"
"Open Obsidian")
(nmap :<leader>ot ":ObsidianToday<cr>"
"Open daily journal")
(nmap :<leader>of ":ObsidianOpen<cr>"
"Open this file in the Obsidian app")
2024-03-16 05:39:18 +00:00
(nmap :<leader>p ":Telescope commands<cr>"
"Search commands")
(nmap :<leader>ff ":Telescope find_files<cr>"
"Search filenames in :pwd")
(nmap :<leader>fb ":Telescope buffers<cr>"
"Search open buffers")
(nmap :<leader>fs ":Telescope live_grep<cr>"
"Search current buffer")
(nmap :<leader>fe ":Telescope emoji<cr>"
"Search for an emoji to copy to clipboard")
2024-03-16 08:19:40 +00:00
(nmap :<leader>gs ":edit term://tig<cr>i"
2024-03-16 05:39:18 +00:00
"Open tig(1) to stage and commit changes")
2024-03-16 08:19:40 +00:00
(nmap :<leader>gn ":edit term://newsboat<cr>i"
"Open newsboat(1)")
2023-07-30 20:41:04 +00:00
(let [duck (require :duck)]
2023-08-04 22:43:22 +00:00
(nmap :<leader><leader> #(duck.hatch) "hatch a duck")
(nmap :<leader>dk #(duck.cook) "cook a duck"))))
2024-03-16 05:39:18 +00:00
:obsidian {:workspaces [{:name "TDC-Obsidian"
:path "/home/specter/TDC-Obsidian"}]
:daily_notes {:folder "Journal/"
:date_format "%Y/%m/%Y-%m-%d"}
:disable_frontmatter true
:ui {
:enable true
:checkboxes {
" " {:char "⬜" :hl_group "ObsidianTodo"}
"x" {:char "✔️" :hl_group "ObsidianDone"}}
:external_link_icon {:char "↗️" :hl_group "ObsidianExtLinkIcon"}}
:wiki_link_func "prepend_note_id"
:follow_url_func (lambda [url] (vim.fn.jobstart ["xdg-open" url]))}
:treesitter-languages [:c :lua :vim :vimdoc :query :fennel :racket]
2023-07-29 15:21:07 +00:00
:language-servers {:lua_ls {:filetypes [:lua]
:Lua {:workspace {:checkThirdParty false}}
:telemetry {:enable false}
:diagnostics {:globals [:vim]}}
:fennel_language_server {:filetypes [:fennel]
:fennel {:workspace {:library (vim.api.nvim_list_runtime_paths)}
:diagnostics {:globals [:vim]}}}
:bashls {:filetypes [:bash]}
:marksman {:filetypes [:markdown]}}
2023-07-29 15:21:07 +00:00
:lsp-attach (fn [_ bufnr]
(let [nmap #(vim.keymap.set :n $1 $2
{:buffer bufnr
:desc (.. "LSP: " $3)})
telescope (require :telescope.builtin)]
(nmap :gd vim.lsp.buf.definition "[G]o to [D]efiniton")
(nmap :gr telescope.lsp_references "[G]o to [R]eferences")
(nmap :gI vim.lsp.buf.implementation
"[G]o to [I]mplementation")))
2023-07-29 15:21:07 +00:00
:cmp-mapping {:<C-j> (cmp.mapping.select_next_item)
:<C-k> (cmp.mapping.select_prev_item)
:<C-d> (cmp.mapping.scroll_docs -4)
:<C-f> (cmp.mapping.scroll_docs 4)
:<C-Space> (cmp.mapping.complete)
:<CR> (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Replace
:select true})
:<Tab> (cmp.mapping (fn [fallback]
(if (cmp.visible) (cmp.select_prev_item)
(luasnip.expand_or_locally_jumpable) (luasnip.expand_or_jump)
(fallback)))
[:i :s])
:<S-Tab> (cmp.mapping (fn [fallback]
(if (cmp.visible)
(cmp.select_prev_item)
(luasnip.locally_jumpable -1)
(luasnip.jump -1) (fallback)))
[:i :s])}})