include all fennel neovim configuration
change
commit c0d7b2ca232f59cf95e1b82b0dc8247babc38395
author Alpha Chen <alpha@kejadlen.dev>
date
parent 07aedad8
diff --git a/.config/nvim/fnl/ale.fnl b/.config/nvim/fnl/ale.fnl
new file mode 100644
index 00000000..524f6075
--- /dev/null
+++ b/.config/nvim/fnl/ale.fnl
@@ -0,0 +1,9 @@
+(set vim.g.omnifunc "ale#completion#OmniFunc")
+(set vim.g.ale_fix_on_save 1)
+(set vim.g.ale_floating_preview 1)
+(set vim.g.ale_floating_window_border [:│ :─ :╭ :╮ :╯ :╰ :│ :─])
+(vim.keymap.set :n :gd "<Plug>(ale_go_to_definition)" {:noremap true})
+(vim.keymap.set :n :gr "<Plug>(ale_find_references)" {:noremap true})
+(vim.keymap.set :n :K "<Plug>(ale_hover)" {:noremap true})
+(vim.keymap.set :n :<C-k> "<Plug>(ale_previous_wrap)" {:silent true})
+(vim.keymap.set :n :<C-j> "<Plug>(ale_next_wrap)" {:silent true})
diff --git a/.config/nvim/fnl/ftplugin/fennel.fnl b/.config/nvim/fnl/ftplugin/fennel.fnl
new file mode 100644
index 00000000..769db05d
--- /dev/null
+++ b/.config/nvim/fnl/ftplugin/fennel.fnl
@@ -0,0 +1,5 @@
+(set vim.bo.formatprg "fnlfmt /dev/stdin")
+
+; (let [{: nvim_create_autocmd : nvim_command} vim.api]
+;   (nvim_create_autocmd :BufWritePre
+;                        {:callback #(nvim_command "normal migggqG`i")}))
diff --git a/.config/nvim/fnl/ftplugin/rust.fnl b/.config/nvim/fnl/ftplugin/rust.fnl
new file mode 100644
index 00000000..45e071a2
--- /dev/null
+++ b/.config/nvim/fnl/ftplugin/rust.fnl
@@ -0,0 +1,2 @@
+(set vim.g.ale_fixers ["rustfmt"])
+(set vim.g.ale_rust_cargo_use_clippy (vim.fn.executable "cargo-clippy"))
diff --git a/.config/nvim/fnl/fzf.fnl b/.config/nvim/fnl/fzf.fnl
new file mode 100644
index 00000000..469e1988
--- /dev/null
+++ b/.config/nvim/fnl/fzf.fnl
@@ -0,0 +1,25 @@
+;;; fzf
+
+;; https://github.com/junegunn/fzf/blob/master/README-VIM.md
+
+(fn init-keymaps []
+  (vim.keymap.set :n :<leader>b ":Buffers<cr>" {:noremap true})
+  (vim.keymap.set :n :<leader>f ":Files<cr>" {:noremap true})
+  (vim.keymap.set :n :<leader>t ":Tags<cr>" {:noremap true}))
+
+;; https://coreyja.com/vim-spelling-suggestions-fzf/
+(fn init-fzf-spell []
+  (let [{: nvim_command : nvim_create_user_command} vim.api
+        {: expand "fzf#run" fzf-run "fzf#wrap" fzf-wrap : spellsuggest} vim.fn
+        sink #(nvim_command (.. "normal! \"_ciw" $1))
+        fzf-spell #(fzf-run (fzf-wrap {:source (spellsuggest (expand :<cword>))
+                                       : sink
+                                       :window {:width 0.9 :height 0.6}}))]
+    (vim.api.nvim_create_user_command :FzfSpell fzf-spell {})
+    (vim.keymap.set :n :z= ":FzfSpell<cr>" {:noremap true})))
+
+(when (vim.fn.isdirectory :/opt/homebrew/opt/fzf/plugin)
+  (vim.opt.rtp:append :/opt/homebrew/opt/fzf)
+  (init-keymaps)
+  (init-fzf-spell))
+