Clean up names and make spellcheck default for text bufs

This commit is contained in:
Alexander Rosenberg 2022-12-02 19:22:59 -08:00
parent 77e6a35fa1
commit ea3ef70214
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
4 changed files with 34 additions and 29 deletions

View File

@ -116,12 +116,12 @@
:h [ "c" "C" "cpp" "cxx" "c++" "cc" ] :h [ "c" "C" "cpp" "cxx" "c++" "cc" ]
:cpp [ "hpp" "hxx" "h++" "hh" "h" "H" ] :cpp [ "hpp" "hxx" "h++" "hh" "h" "H" ]
:hpp [ "cpp" "cxx" "c++" "cc" ]) :hpp [ "cpp" "cxx" "c++" "cc" ])
(let [find_other (require :nvim-find-other)] (let [find-other (require :nvim-find-other)]
(vim.api.nvim_create_user_command (vim.api.nvim_create_user_command
"FindOtherFile" "FindOtherFile"
find_other.find_other_current_buffer find-other.find_other_current_buffer
{}) {})
(bind! :n :go find_other.find_other_current_buffer)))) (bind! :n :go find-other.find_other_current_buffer))))
(use! :RRethy/vim-illuminate (use! :RRethy/vim-illuminate
:config (fn [] :config (fn []

View File

@ -4,17 +4,17 @@
(fn configure [] (fn configure []
(hook! :FileType :java (hook! :FileType :java
#(let [root_dir (module-call! :jdtls.setup :find_root #(let [root-dir (module-call! :jdtls.setup :find_root
[ ".git" "mvnw" "gradlew" "build.gradle" ]) [ ".git" "mvnw" "gradlew" "build.gradle" ])
lsp_cap (module-call! :cmp_nvim_lsp :default_capabilities)] lsp-cap (module-call! :cmp_nvim_lsp :default_capabilities)]
(module-call! :jdtls :start_or_attach (module-call! :jdtls :start_or_attach
{ :capabilities lsp_cap { :capabilities lsp-cap
:on_attach (module-fn! :plugin.lsp :on-attach) :on_attach (module-fn! :plugin.lsp :on-attach)
:root_dir root_dir :root_dir root-dir
:cmd [ "jdtls" :cmd [ "jdtls"
"-data" "-data"
(module-call! :plugin.lsp (module-call! :plugin.lsp
:get-data-dir :get-data-dir
:jdtls root_dir) ]})))) :jdtls root-dir) ]}))))
{: configure} {: configure}

View File

@ -39,24 +39,24 @@
(fn configure [] (fn configure []
(let [lsp (require :lspconfig) (let [lsp (require :lspconfig)
configs (require :lspconfig.configs) configs (require :lspconfig.configs)
lsp_cap ((. (require :cmp_nvim_lsp) :default_capabilities)) lsp-cap ((. (require :cmp_nvim_lsp) :default_capabilities))
lsp_utils (require :plugin.lsp)] lsp-utils (require :plugin.lsp)]
(macro setup_server! [name ...] (macro setup-server! [name ...]
(let [opts { :on-attach `lsp_utils.on_attach (let [opts { :on-attach `lsp-utils.on-attach
:capabilities `lsp_cap }] :capabilities `lsp-cap }]
(var last_key nil) (var last-key nil)
(each [_ val (ipairs [...])] (each [_ val (ipairs [...])]
(if last_key (if last-key
(do (tset opts last_key val) (do (tset opts last-key val)
(set last_key nil)) (set last-key nil))
(set last_key val))) (set last-key val)))
`((. (. lsp ,name) :setup) ,opts))) `((. (. lsp ,name) :setup) ,opts)))
(setup_server! :ccls) (setup-server! :ccls)
(setup_server! :cmake) (setup-server! :cmake)
(setup_server! :gopls) (setup-server! :gopls)
(setup_server! :rust_analyzer) (setup-server! :rust_analyzer)
(setup_server! :texlab) (setup-server! :texlab)
(setup_server! :sumneko_lua (setup-server! :sumneko_lua
:settings { :settings {
:Lua { :Lua {
:runtime { :runtime {
@ -82,6 +82,6 @@
:globals [ "vim" ] }}}}}) :globals [ "vim" ] }}}}})
; needed to make it not complain about a nil setup function ; needed to make it not complain about a nil setup function
(if configs.fennel_language_server.setup (if configs.fennel_language_server.setup
(setup_server! :fennel_language_server)))) (setup-server! :fennel_language_server))))
{ : configure : on-attach : get-data-dir } { : configure : on-attach : get-data-dir }

View File

@ -1,6 +1,6 @@
;;; init.fnl - primary init file ;;; init.fnl - primary init file
(import-macros {: bind! : module-call!} :macros) (import-macros {: bind! : module-call! : hook!} :macros)
;; Make space leader ;; Make space leader
(set vim.g.mapleader " ") (set vim.g.mapleader " ")
@ -70,12 +70,17 @@
;; Spell keybindings ;; Spell keybindings
(bind! :n :<leader>l (fn [] (bind! :n :<leader>l (fn []
(let [new_spell (not (vim.opt_local.spell:get))] (let [new-spell (not (vim.opt_local.spell:get))]
(set vim.opt_local.spell new_spell) (set vim.opt_local.spell new-spell)
(print (if new_spell (print (if new-spell
"Enabled Spellcheck" "Enabled Spellcheck"
"Disabled Spellcheck"))))) "Disabled Spellcheck")))))
;; Enable spell in certian buffers
(hook! :FileType [ :text :markdown :tex :bib ]
#(if (= (vim.fn.buflisted (vim.api.nvim_get_current_buf)) 1)
(set vim.opt_local.spell true)))
(fn jump-or-open-terminal [] (fn jump-or-open-terminal []
"If no terminal buffer exists, create one. Otherwise, open new one." "If no terminal buffer exists, create one. Otherwise, open new one."
(var term_count 0) (var term_count 0)