diff --git a/.config/nvim/fnl/init.fnl b/.config/nvim/fnl/init.fnl index ea5314d..5414d39 100644 --- a/.config/nvim/fnl/init.fnl +++ b/.config/nvim/fnl/init.fnl @@ -1,15 +1,35 @@ (vim.cmd "colorscheme paramount") (set vim.opt.list true) -(set vim.opt.listchars "tab:\\u21e5 ,trail:\\u2423,extends:\\u21c9,precedes:\\u21c7,nbsp:\\u00b7") +(set vim.opt.listchars {:tab "\\u21e5 " + :trail "\\u2423" + :extends "\\u21c9" + :precedes "\\u21c7" + :nbsp "\\u00b7"}) + (set vim.opt.number true) (set vim.g.mapleader " ") +; (let [{: keymap} vim +; nnoremap #(keymap.set :n $1 $2 {:noremap true}) +; inoremap #(keymap.set :i $1 $2 {:noremap true})] + +; ; clear hl +; (nnoremap :/ ":nohlsearch") + +; ; quick save +; (nnoremap "\\\\" ":write") +; (inoremap "\\\\" ":write") + +; ; fzf +; (nnoremap :b ":Buffers") +; (nnoremap :f ":Files") +; (nnoremap :t ":Tags")) (vim.keymap.set :n "\\\\" ":write" {:noremap true}) (vim.keymap.set :i "\\\\" ":write" {:noremap true}) -(vim.keymap.set :n :/ ":nohlsearch" opts) +(vim.keymap.set :n :/ ":nohlsearch" {:noremap true}) ;; restore cursor location ;; @@ -17,11 +37,10 @@ (let [{: nvim_command : nvim_create_autocmd : nvim_create_augroup} vim.api au-group (nvim_create_augroup :nvim-startup {}) cb (fn [] - (when (and - (>= (vim.fn.line "'\"") 1) - (<= (vim.fn.line "'\"") (vim.fn.line "$")) - (not (string.find vim.bo.filetype "commit"))) - (nvim_command "normal! g`\"")))] + (when (and (>= (vim.fn.line "'\"") 1) + (<= (vim.fn.line "'\"") (vim.fn.line "$")) + (not (string.find vim.bo.filetype :commit))) + (nvim_command "normal! g`\"")))] ;; when restoring the cursor, we want to ignore commit filetypes, so ;; we need to manually enable filetype detection to set up those ;; autocommands before creating the autocommand to restore the cursor @@ -43,6 +62,26 @@ (set vim.g.ale_fix_on_save 1) (set vim.g.ale_floating_preview 1) +;; fzf + +(when (vim.fn.executable :fzf) + (when (vim.fn.isdirectory :/opt/homebrew/opt/fzf/plugin) + (vim.opt.rtp:append :/opt/homebrew/opt/fzf)) + (vim.keymap.set :n :b ":Buffers" {:noremap true}) + (vim.keymap.set :n :f ":Files" {:noremap true}) + (vim.keymap.set :n :t ":Tags" {:noremap true}) + + ; https://coreyja.com/vim-spelling-suggestions-fzf/ + (let [{: nvim_command : nvim_create_user_command} vim.api + {: expand : spellsuggest} vim.fn + fzf-run (. vim.fn "fzf#run") + sink #(nvim_command (.. "normal! \"_ciw" $1)) + fzf-spell #(fzf-run {:source (spellsuggest (expand :)) + : sink + :window {:width 0.9 :height 0.6}})] + (nvim_create_user_command :FzfSpell fzf-spell {}) + (vim.keymap.set :n :z= ":FzfSpell"))) + ;; lspconfig ; (let [opts {:noremap true :silent true}] ; (vim.keymap.set :n :e vim.diagnostic.open_float opts) diff --git a/.gitmodules b/.gitmodules index ba12269..a944819 100644 --- a/.gitmodules +++ b/.gitmodules @@ -168,3 +168,6 @@ [submodule ".local/share/nvim/site/pack/kejadlen/start/ale"] path = .local/share/nvim/site/pack/kejadlen/start/ale url = https://github.com/dense-analysis/ale.git +[submodule ".local/share/nvim/site/pack/kejadlen/start/fzf"] + path = .local/share/nvim/site/pack/kejadlen/start/fzf + url = https://github.com/junegunn/fzf.vim.git diff --git a/.local/share/nvim/site/pack/kejadlen/start/fzf b/.local/share/nvim/site/pack/kejadlen/start/fzf new file mode 160000 index 0000000..c311c0a --- /dev/null +++ b/.local/share/nvim/site/pack/kejadlen/start/fzf @@ -0,0 +1 @@ +Subproject commit c311c0a95fc2529c26ab36a8f530e9dd4426304c