nvim-config/fnl/personalize.fnl

93 lines
4.8 KiB
Plaintext
Raw Normal View History

2023-07-29 15:21:07 +00:00
(let [cmp (require :cmp)
luasnip (require :luasnip)]
{: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)
(set vim.o.clipboard :unnamedplus)
(set vim.o.wrap false)
(set vim.opt.colorcolumn "80,120")
(vim.cmd.colorscheme :everforest)
2023-08-02 04:56:30 +00:00
(set vim.o.formatoptions :tncro)
2023-08-04 18:18:59 +00:00
(set vim.o.conceallevel 2)
(set vim.o.splitbelow true)
(set vim.o.splitright true))
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})
tmap #(vim.keymap.set :t $1 $2)]
2023-08-11 02:08:36 +00:00
(nmap :<Tab> :<C-^> "Toggle alternate-file")
2023-08-04 22:43:22 +00:00
(nmap :<C-x> ":bn|bd!#<cr>" "Delete a buffer without removing the split")
(nmap :<leader>w :80<C-W>|)
2023-08-04 18:18:59 +00:00
(nmap :<C-h> :<C-W>h)
(nmap :<C-j> :<C-W>j)
(nmap :<C-k> :<C-W>k)
(nmap :<C-l> :<C-W>l)
2023-08-04 22:43:22 +00:00
(tmap :<C-h> :<C-\><C-n><C-w>h)
(tmap :<C-j> :<C-\><C-n><C-w>j)
(tmap :<C-k> :<C-\><C-n><C-w>k)
(tmap :<C-l> :<C-\><C-n><C-w>l)
2023-08-11 02:08:36 +00:00
(tmap :<C-w> "<C-\\><C-n>")
2023-08-04 22:43:22 +00:00
(nmap :<leader>to ":new term://bash|resize 8<cr>")
(vim.api.nvim_create_autocmd
[:BufWinEnter :WinEnter]
{:pattern "term://*"
:command "startinsert"})
(nmap :<leader>dj
#(vim.cmd (.. "vsplit ~/TDC-Obsidian/Journal/"
(os.date "%Y") "/"
(os.date "%m") "/"
2024-01-06 18:39:05 +00:00
(os.date "%Y-%m-%d")
".md")
"Open today's journal"))
(nmap :<leader>o ":Telescope find_files<cr>" "Telescope find_files")
(nmap :<leader>b ":Telescope buffers<cr>" "Telescope buffers")
(nmap :<leader>s ":Telescope live_grep<cr>" "Telescope live_grep")
2023-08-11 02:08:36 +00:00
(nmap :<leader>e ":Telescope emoji<cr>" "Telescope emoji")
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")
2023-07-30 20:41:04 +00:00
(nmap :<leader>dk #(duck.cook) "cook a duck"))
))
2023-07-29 15:21:07 +00:00
: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])}})