Clean up fennel function names

This commit is contained in:
Alexander Rosenberg 2022-12-02 16:38:31 -08:00
parent 043d485629
commit 77e6a35fa1
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
3 changed files with 11 additions and 11 deletions

View File

@ -9,12 +9,12 @@
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

@ -2,7 +2,7 @@
(import-macros {: bind!} :macros) (import-macros {: bind!} :macros)
(fn on_attach [_ buf] (fn on-attach [_ buf]
(bind! :n :gD vim.lsp.buf.declaration buf) (bind! :n :gD vim.lsp.buf.declaration buf)
(bind! :n :gd vim.lsp.buf.definition buf) (bind! :n :gd vim.lsp.buf.definition buf)
(bind! :n :K vim.lsp.buf.hover buf) (bind! :n :K vim.lsp.buf.hover buf)
@ -28,7 +28,7 @@
(bind! :n :<leader>fd fzf.lsp_document_symbols buf) (bind! :n :<leader>fd fzf.lsp_document_symbols buf)
(bind! :n :<leader>cn fzf.lsp_code_actions buf))) (bind! :n :<leader>cn fzf.lsp_code_actions buf)))
(fn get_data_dir [server root] (fn get-data-dir [server root]
(let [resolved_path (vim.fn.resolve root) (let [resolved_path (vim.fn.resolve root)
joined_path (vim.fn.substitute resolved_path "\\/" "@" :g)] joined_path (vim.fn.substitute resolved_path "\\/" "@" :g)]
(.. (vim.fn.fnamemodify (.. "~/.local/nvim/lsp-cache/" (.. (vim.fn.fnamemodify (.. "~/.local/nvim/lsp-cache/"
@ -42,7 +42,7 @@
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 [...])]
@ -84,4 +84,4 @@
(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

@ -58,15 +58,15 @@
(set vim.g.loaded_netrwPlugin 1) (set vim.g.loaded_netrwPlugin 1)
;; Remove trailing whitespace ;; Remove trailing whitespace
(fn remove_trailing_whitespace [] (fn remove-trailing-whitespace []
"Remove trailing whitespace from the whole file." "Remove trailing whitespace from the whole file."
(let [res (pcall vim.cmd "%s/ \\+$//gc")] (let [res (pcall vim.cmd "%s/ \\+$//gc")]
(vim.cmd.nohlsearch) (vim.cmd.nohlsearch)
(when (not res) (when (not res)
(print "File is clean")))) (print "File is clean"))))
(vim.api.nvim_create_user_command :RemoveTrailingWhitespace (vim.api.nvim_create_user_command :RemoveTrailingWhitespace
remove_trailing_whitespace {}) remove-trailing-whitespace {})
(bind! :n :<leader>ws remove_trailing_whitespace) (bind! :n :<leader>ws remove-trailing-whitespace)
;; Spell keybindings ;; Spell keybindings
(bind! :n :<leader>l (fn [] (bind! :n :<leader>l (fn []
@ -76,7 +76,7 @@
"Enabled Spellcheck" "Enabled Spellcheck"
"Disabled Spellcheck"))))) "Disabled Spellcheck")))))
(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)
(var last_id 0) (var last_id 0)
@ -96,7 +96,7 @@
(fn [choice] (fn [choice]
(when choice (when choice
(vim.cmd.buffer choice)))))) (vim.cmd.buffer choice))))))
(bind! :n :<leader>t jump_or_open_terminal) (bind! :n :<leader>t jump-or-open-terminal)
;; Some keybindings for diagnostics ;; Some keybindings for diagnostics
(bind! :n :<leader>e vim.diagnostic.open_float) (bind! :n :<leader>e vim.diagnostic.open_float)