dialing it in...

This commit is contained in:
secretspecter 2024-03-15 23:39:18 -06:00
parent e1e2c7f0be
commit 3437e27696
7 changed files with 152 additions and 119 deletions

View file

@ -1,4 +1,4 @@
# Lisp Flavored NeoVim # Scheme/Lisp Flavored NeoVim
Configuration via Fennel. Tuned for s-expressions and prose. Configuration via Fennel. Tuned for s-expressions and prose.
## How ## How

View file

@ -5,67 +5,104 @@
(set vim.g.mapleader " ") (set vim.g.mapleader " ")
(set vim.g.maplocalleader "\\") (set vim.g.maplocalleader "\\")
(set vim.o.termguicolors true) (set vim.o.termguicolors true)
(set vim.o.clipboard :unnamedplus) (set vim.opt.clipboard :unnamedplus)
(set vim.o.wrap false) (set vim.o.wrap false)
(set vim.opt.colorcolumn "80,120") (set vim.opt.colorcolumn "80,120")
(vim.cmd.colorscheme :everforest) (vim.cmd.colorscheme :quiet)
(set vim.o.formatoptions :tncro) (set vim.o.formatoptions :tncro)
(set vim.o.conceallevel 2) (set vim.o.conceallevel 2) ;; 🤞 for anticonceal
(set vim.o.foldlevel 1)
(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)
(set vim.g.sexp_filetypes "racket,fennel,scheme,lisp"))
: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 {:desc (.. $3 " (from a terminal)")})] tmap #(vim.keymap.set :t $1 $2 {:desc (.. $3 " (from a terminal)")})]
(nmap :<C-h> :<C-W>h "Move to window left") (nmap :<C-h> :<C-W>h
(tmap :<C-h> :<C-\><C-n><C-w>h "Move to window left") "Move to window left")
(nmap :<C-j> :<C-W>j "Move to window down") (tmap :<C-h> :<C-\><C-n><C-w>h
(tmap :<C-j> :<C-\><C-n><C-w>j "Move to window down") "Move to window left")
(nmap :<C-k> :<C-W>k "Move to window up") (nmap :<C-j> :<C-W>j
(tmap :<C-k> :<C-\><C-n><C-w>k "Move to window up") "Move to window down")
(nmap :<C-l> :<C-W>l "Move to window right") (tmap :<C-j> :<C-\><C-n><C-w>j
(tmap :<C-l> :<C-\><C-n><C-w>l "Move to window right") "Move to window down")
(tmap :<C-w> "<C-\\><C-n>" "Escape to normal mode") (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")
(vim.api.nvim_create_autocmd (vim.api.nvim_create_autocmd
[:BufWinEnter :WinEnter] [:BufWinEnter :WinEnter]
{:pattern "term://*" {:pattern "term://*"
:command "startinsert"}) ;; Start terminals in insert mode :command :startinsert}) ;; Start terminals in insert
(nmap :<Tab> :<C-^> "Toggle alternate-file") (nmap :<C-x> ":bn|bd!#<cr>"
(nmap :<C-x> ":bn|bd!#<cr>" "Delete a buffer without removing the split") "Delete a buffer without removing the split")
(nmap :<leader>tt ":term<cr>i" "Open a terminal in the current window") (nmap :<leader>tt ":term<cr>i"
(nmap :<leader>to ":new term://bash|resize 8<cr>" "Open an 8 line terminal below the current window") "Open a terminal in the current window")
(nmap :<leader>w :80<C-W>| "Set the window width to 80 characters") (nmap :<leader>to ":new term://bash|resize 8<cr>"
(nmap :<leader>W :120<C-W>| "Set the window width to 120 characters") "Open an 8 line terminal below the current window")
(nmap :<C-t> ":tabnew<cr>" "Create a new tab page") (nmap :<leader>w :80<C-W>|
(tmap :<C-t> "<C-\\><C-n>:tabnew<cr>" "Create a new tab page") "Set the window width to 80 characters")
(nmap :<C-w><tab> :<C-w>gt "Go to next tab (cyclical)") (nmap :<leader>W :120<C-W>|
(tmap :<C-w><tab> "<C-\\><C-n><C-w>gt" "Go to next tab (cyclical)") "Set the window width to 120 characters")
(nmap :<leader>oo (nmap :<C-w>t ":tabnew<cr>"
#(vim.cmd (.. "cd ~/TDC-Obsidian/|edit WIP.md") "Create a new tab page")
"Open Obsidian")) (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)")
(nmap :<leader>p ":Telescope commands<cr>" "Search commands") (nmap :<leader>oo ":tcd ~/TDC-Obsidian/|edit WIP.md<cr>"
(nmap :<leader>o ":Telescope find_files<cr>" "Search filenames in :pwd") "Open Obsidian")
(nmap :<leader>b ":Telescope buffers<cr>" "Search open buffers") (nmap :<leader>ot ":ObsidianToday<cr>"
(nmap :<leader>s ":Telescope live_grep<cr>" "Search current buffer") "Open daily journal")
(nmap :<leader>e ":Telescope emoji<cr>" "Search for an emoji to copy to clipboard") (nmap :<leader>of ":ObsidianOpen<cr>"
"Open this file in the Obsidian app")
(nmap :<leader>gs ":vsplit term://tig<cr>" "Open tig(1) to stage and commit changes") (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")
(nmap :<leader>gs ":edit term://tig<cr>"
"Open tig(1) to stage and commit changes")
(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 :obsidian {:workspaces [{:name "TDC-Obsidian"
:lua :path "/home/specter/TDC-Obsidian"}]
:vim :daily_notes {:folder "Journal/"
:vimdoc :date_format "%Y/%m/%Y-%m-%d"}
:query :disable_frontmatter true
:fennel :ui {
:racket] :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]
:language-servers {:lua_ls {:filetypes [:lua] :language-servers {:lua_ls {:filetypes [:lua]
:Lua {:workspace {:checkThirdParty false}} :Lua {:workspace {:checkThirdParty false}}

View file

@ -1,13 +1,17 @@
(set vim.g.sexp_filetypes "racket,fennel") ;; FIXME: This belongs in personalize.fnl It's also here because it fixes a bug with racket filetypes...
(set vim.g.sexp_filetypes "racket,fennel,scheme,lisp")
(let [lazy (require :lazy)] (let [lazy (require :lazy)]
(lazy.setup ["https://github.com/rktjmp/hotpot.nvim" (lazy.setup ["https://github.com/rktjmp/hotpot.nvim"
{:url "https://github.com/nvim-treesitter/nvim-treesitter"
:build ":TSUpdate"}
"https://github.com/tpope/vim-sexp-mappings-for-regular-people" "https://github.com/tpope/vim-sexp-mappings-for-regular-people"
"https://github.com/guns/vim-sexp" "https://github.com/guns/vim-sexp"
"https://github.com/benknoble/vim-racket"
"https://github.com/preservim/vim-markdown" "https://github.com/preservim/vim-markdown"
{:url "https://github.com/epwalsh/obsidian.nvim"
:version "v3.7.1"}
"https://github.com/nvim-lua/plenary.nvim" "https://github.com/nvim-lua/plenary.nvim"
{:url "https://github.com/nvim-treesitter/nvim-treesitter"
:build ":TSUpdate"}
{:url "https://github.com/neovim/nvim-lspconfig" {:url "https://github.com/neovim/nvim-lspconfig"
:dependencies ["https://github.com/williamboman/mason.nvim" :dependencies ["https://github.com/williamboman/mason.nvim"
:williamboman/mason-lspconfig.nvim :williamboman/mason-lspconfig.nvim
@ -31,22 +35,11 @@
" && cmake --build build --config Release" " && cmake --build build --config Release"
" && cmake --install build --prefix build")} " && cmake --install build --prefix build")}
"https://github.com/xiyaowong/telescope-emoji.nvim"]} "https://github.com/xiyaowong/telescope-emoji.nvim"]}
{:url "https://github.com/epwalsh/obsidian.nvim"
:version "v3.7.1"
:ft "markdown"
:opts {: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 false}}}
"https://github.com/sainnhe/everforest"
"https://github.com/tamton-aquib/duck.nvim"])) "https://github.com/tamton-aquib/duck.nvim"]))
;; yup that's the same line as above... it "fixes" racket and the for-regular-people ;; NOTE: If a value could be considered a preference or is subjective
;; plugin for me... :/ ;; then it should be defined in personalize.fnl
(set vim.g.sexp_filetypes "racket,fennel") ;; Otherwise packaging details and less malleable values, by nature or desire, belong below...
(let [personalize (require :personalize)] (let [personalize (require :personalize)]
(personalize.options) (personalize.options)
@ -56,6 +49,57 @@
(pcall (telescope.load_extension :fzf)) (pcall (telescope.load_extension :fzf))
(pcall (telescope.load_extension :emoji))) (pcall (telescope.load_extension :emoji)))
(require :setup-treesitter) (let [cmp (require :cmp)
(require :setup-mason) luasnip (require :luasnip)
(require :setup-cmp) vscode-snips (require :luasnip.loaders.from_vscode)
{: cmp-mapping} (require :personalize)]
(vscode-snips.lazy_load)
(luasnip.config.setup)
(cmp.setup {:snippet {:expand #(luasnip $1)}
:mapping (cmp.mapping.preset.insert cmp-mapping)
:sources (cmp.config.sources [{:name :nvim_lsp}
{:name :luasnip}
{:name :buffer}])})
(cmp.setup.cmdline ["/" "?"]
{:mapping (cmp.mapping.preset.cmdline)
:sources [{:name :buffer}]})
(cmp.setup.cmdline [":"]
{:mapping (cmp.mapping.preset.cmdline)
:sources (cmp.config.sources [{:name :path}
{:name :cmdline}])})
(cmp.setup.filetype [:gitcommit]
{:mapping (cmp.mapping.preset.cmdline)
:sources (cmp.config.sources [{:name :git}
{:name :buffer}])}))
(let [obsidian (require :obsidian)
personalize (require :personalize)]
(obsidian.setup personalize.obsidian))
(let [treesitter (require :nvim-treesitter.configs)
{: treesitter-languages} (require :personalize)]
(treesitter.setup {:ensure_installed treesitter-languages
:sync_install false
:auto_install true
:highlight {:enable true}
:indent {:enable true}}))
(let [neodev (require :neodev)
mason (require :mason)
mason-lspconfig (require :mason-lspconfig)
{: language-servers : lsp-attach} (require :personalize)]
(neodev.setup)
(mason.setup)
(mason-lspconfig.setup {:ensure_installed (vim.tbl_keys language-servers)})
(mason-lspconfig.setup_handlers
[(fn [server_name]
(let [server (. (require :lspconfig)
server_name)
cmp-nvim-lsp (require :cmp_nvim_lsp)
settings (. language-servers
server_name)]
(server.setup {:capabilities (cmp-nvim-lsp.default_capabilities (vim.lsp.protocol.make_client_capabilities))
:on_attach lsp-attach
: settings
:filetypes (or settings.filetypes
[])})))]))

View file

@ -1,22 +0,0 @@
(let [cmp (require :cmp)
luasnip (require :luasnip)
vscode-snips (require :luasnip.loaders.from_vscode)
{: cmp-mapping} (require :personalize)]
(vscode-snips.lazy_load)
(luasnip.config.setup)
(cmp.setup {:snippet {:expand #(luasnip $1)}
:mapping (cmp.mapping.preset.insert cmp-mapping)
:sources (cmp.config.sources [{:name :nvim_lsp}
{:name :luasnip}
{:name :buffer}])})
(cmp.setup.cmdline ["/" "?"]
{:mapping (cmp.mapping.preset.cmdline)
:sources [{:name :buffer}]})
(cmp.setup.cmdline [":"]
{:mapping (cmp.mapping.preset.cmdline)
:sources (cmp.config.sources [{:name :path}
{:name :cmdline}])})
(cmp.setup.filetype [:gitcommit]
{:mapping (cmp.mapping.preset.cmdline)
:sources (cmp.config.sources [{:name :git}
{:name :buffer}])}))

View file

@ -1,19 +0,0 @@
(let [neodev (require :neodev)
mason (require :mason)
mason-lspconfig (require :mason-lspconfig)
{: language-servers : lsp-attach} (require :personalize)]
(neodev.setup)
(mason.setup)
(mason-lspconfig.setup {:ensure_installed (vim.tbl_keys language-servers)})
(mason-lspconfig.setup_handlers
[(fn [server_name]
(let [server (. (require :lspconfig)
server_name)
cmp-nvim-lsp (require :cmp_nvim_lsp)
settings (. language-servers
server_name)]
(server.setup {:capabilities (cmp-nvim-lsp.default_capabilities (vim.lsp.protocol.make_client_capabilities))
:on_attach lsp-attach
: settings
:filetypes (or settings.filetypes
[])})))]))

View file

@ -1,7 +0,0 @@
(let [treesitter (require :nvim-treesitter.configs)
{: treesitter-languages} (require :personalize)]
(treesitter.setup {:ensure_installed treesitter-languages
:sync_install false
:auto_install true
:highlight {:enable true}
:indent {:enable true}}))

View file

@ -6,23 +6,23 @@
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"duck.nvim": { "branch": "main", "commit": "d8a6b08af440e5a0e2b3b357e2f78bb1883272cd" }, "duck.nvim": { "branch": "main", "commit": "d8a6b08af440e5a0e2b3b357e2f78bb1883272cd" },
"everforest": { "branch": "master", "commit": "d8ce3131f7491c61bd751bd455e2ddc0d47e74e9" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, "friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" },
"hotpot.nvim": { "branch": "master", "commit": "b18d3d82e8545d9f765870c1d8f0da041bd61097" }, "hotpot.nvim": { "branch": "master", "commit": "b18d3d82e8545d9f765870c1d8f0da041bd61097" },
"lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" }, "lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "82c7cb08ddb836ad938b2708e50085f12a8825d2" },
"mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" },
"neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" }, "neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-lspconfig": { "branch": "master", "commit": "16295b79410f131c4fa7870c663b4ace6a761fb2" }, "nvim-lspconfig": { "branch": "master", "commit": "4bdd3800b4148f670c6cf55ef65f490148eeb550" },
"nvim-treesitter": { "branch": "master", "commit": "7ff51f53b0efb6228df2e8539b51bb2e737b77f3" }, "nvim-treesitter": { "branch": "master", "commit": "f87882858438834d2fbb6379aa2be37de901751b" },
"obsidian.nvim": { "branch": "main", "commit": "b136c1545fb9c4888d37ba482bfc77f222bbdf52" }, "obsidian.nvim": { "branch": "main", "commit": "b136c1545fb9c4888d37ba482bfc77f222bbdf52" },
"plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" }, "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
"telescope-emoji.nvim": { "branch": "master", "commit": "86248d97be84a1ce83f0541500ef9edc99ea2aa1" }, "telescope-emoji.nvim": { "branch": "master", "commit": "86248d97be84a1ce83f0541500ef9edc99ea2aa1" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
"telescope.nvim": { "branch": "master", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" }, "telescope.nvim": { "branch": "master", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" },
"vim-markdown": { "branch": "master", "commit": "a657e697376909c41475a686eeef7fc7a4972d94" }, "vim-markdown": { "branch": "master", "commit": "a657e697376909c41475a686eeef7fc7a4972d94" },
"vim-racket": { "branch": "master", "commit": "eec2017083c302677459b4607a319954d7390b84" },
"vim-sexp": { "branch": "master", "commit": "14464d4580af43424ed8f2614d94e62bfa40bb4d" }, "vim-sexp": { "branch": "master", "commit": "14464d4580af43424ed8f2614d94e62bfa40bb4d" },
"vim-sexp-mappings-for-regular-people": { "branch": "master", "commit": "cc5923e357373ea6ef0c13eae82f44e6b9b1d374" } "vim-sexp-mappings-for-regular-people": { "branch": "master", "commit": "cc5923e357373ea6ef0c13eae82f44e6b9b1d374" }
} }