;;; plugin.fnl - plugin configurations (import-macros {: bind! : hook! : use! : setup! : module-call! : module-fn! } :macros) (fn [use] ;; Packer (use! :wbthomason/packer.nvim) ;; tangerine.nvim (auto fennel compile) (use! :udayvir-singh/tangerine.nvim) ;; Treesitter (use! :nvim-treesitter/nvim-treesitter :config (setup! :nvim-treesitter.configs ;:ensure_installed :all ;:sync_install false ;:auto_install true :highlight { :enable true :additional_vim_regex_highlighting false } :indent { :enable true })) ;; nightfox.nvim (colorscheme) (use! :EdenEast/nightfox.nvim :after :nvim-treesitter :config (vim.cmd.colorscheme :carbonfox)) ;; Arm asm syntax (use! :https://git.zander.im/Zander671/arm-syntax-vim.git) ;; Devicons (use! :kyazdani42/nvim-web-devicons) ;; lualine.nvim (use! :nvim-lualine/lualine.nvim :after [ :nightfox.nvim :nvim-web-devicons ] :config (setup! :lualine :options { :section_separators "" :component_separators "│" } ; :sections { :lualine_x [ ; { 1 #(.. "recording @" (vim.fn.reg_recording)) ; :cond #(not= (# (vim.fn.reg_recording)) 0) } ; :encoding ; :fileformat ; :filetype ]} )) ;; bufferline.nvim (use! :akinsho/bufferline.nvim :after [ :nvim-web-devicons :nightfox.nvim ] :config (setup! :bufferline :options { :always_show_bufferline false :mode :tabs :numbers :buffer-id :show_buffer_close_icons false :show_close_icon false })) ;; telescope (a fuzzy finder) (use! :nvim-telescope/telescope.nvim :cmd :Telescope :module :telescope :requires [ { 1 :nvim-lua/plenary.nvim :opt true } { 1 :nvim-telescope/telescope-ui-select.nvim :opt true } { 1 :nvim-telescope/telescope-fzf-native.nvim :opt true :run :make }] :setup (bind! :n :fq "Telescope quickfix") (bind! :n :fr "Telescope registers") (bind! :n :fj "Telescope jumplist") (bind! :n :fa "Telescope marks") (bind! :n :fh "Telescope help_tags") (bind! :n :g "Telescope live_grep") (bind! :n :fg "Telescope live_grep") (bind! :n :d "Telescope treesitter") (bind! :n :b "Telescope buffers") (bind! :n :fu "Telescope git_status") (bind! :n :fm "Telescope man_pages") (bind! :n :fe "Telescope diagnostics") (bind! :n :fl "Telescope loclist") (bind! :n :fp "Telescope spell_suggest") (bind! :n :fo "Telescope vim_options") (bind! :n :c "Telescope command_history") (bind! :n :i "Telescope find_files") (bind! :n :i "Telescope find_files") (bind! :n :z= "Telescope spell_suggest") (fn list-git-or-default [] (let [code (os.execute "git rev-parse --is-inside-work-tree >/dev/null 2>&1")] (if (= code 0) (vim.cmd "Telescope git_files") (vim.cmd "Telescope find_files")))) (bind! :n :ff list-git-or-default) (bind! :n :u list-git-or-default) (fn jump-or-open-terminal [] "If no terminal buffer exists, create one. Otherwise, open new one." (var term_count 0) (var last_id 0) (var terms [ ]) (each [_ id (pairs (vim.api.nvim_list_bufs))] (let [name (vim.api.nvim_buf_get_name id)] (when (vim.startswith name "term://") (table.insert terms name) (set term_count (+ term_count 1)) (set last_id id)))) (if (= term_count 0) (vim.cmd.terminal) (= term_count 1) (vim.cmd.buffer last_id) (vim.cmd "Telescope buffers default_text=term://"))) (bind! :n :t jump-or-open-terminal) :config (vim.cmd "PackerLoad plenary.nvim") (vim.cmd "PackerLoad telescope-ui-select.nvim") (vim.cmd "PackerLoad telescope-fzf-native.nvim") (let [actions (require :telescope.actions)] (setup! :telescope :defaults { :mappings { :i { : actions.close : actions.move_selection_previous : actions.move_selection_next } :n { : actions.move_selection_previous : actions.move_selection_next }}} :pickers { :buffers { ;;:ignore_current_buffer true :sort_lastused true }} :extensions { :ui-select [ (module-call! :telescope.themes :get_dropdown) ] }) (module-call! :telescope :load_extension :ui-select) (module-call! :telescope :load_extension :fzf))) ;; Trouble (use! :folke/trouble.nvim :cmd [ :Trouble :TroubleToggle :TroubleClose :TroubleRefresh ] :config (setup! :trouble)) ;; Nvim surround (use! :kylechui/nvim-surround :config (setup! :nvim-surround)) ;; Leap (use! :ggandor/leap.nvim :after :nvim-treesitter :config ((. (require :leap) :add_default_mappings)) (bind! :o :z "(leap-forward-to)") (bind! :o :Z "(leap-backward-to)") (vim.api.nvim_set_hl 0 :LeapBackdrop { :link :Comment })) ;; Leap spooky (remote operations) (use! :ggandor/leap-spooky.nvim :after :leap.nvim :config (setup! :leap-spooky)) ;; Flit (leap for 'till' and 'forward' motions) (use! :ggandor/flit.nvim :after :leap.nvim :config (setup! :flit)) ;; Comment.nvim (use! :numToStr/Comment.nvim :keys [ :gc :gb ] :config (setup! :Comment)) ;; nvim-find-other (use! "https://git.zander.im/Zander671/nvim-find-other.git" :config (setup! :nvim-find-other :c [ "h" "H" ] :h [ "c" "C" "cpp" "cxx" "c++" "cc" ] :cpp [ "hpp" "hxx" "h++" "hh" "h" "H" ] :hpp [ "cpp" "cxx" "c++" "cc" ]) (let [find-other (require :nvim-find-other)] (vim.api.nvim_create_user_command "FindOtherFile" find-other.find_other_current_buffer {}) (bind! :n :go find-other.find_other_current_buffer))) ;; illuminate (same symbol highlight) (use! :RRethy/vim-illuminate :config (module-call! :illuminate :configure { :providers [ "lsp" "treesitter" "ragex" ] :filetypes_denylist [ :Trouble :markdown :text :gitconfig :gitignore ] :delay 0 }) (hook! :FileType :lua #(vim.api.nvim_set_hl 0 :IlluminatedWordText {}))) ;; vlime (lisp environment) (use! :vlime/vlime :ft :lisp :config (set vim.g.vlime_cl_impl :my_sbcl) (set vim.g.vlime_address [ "127.0.0.1" 52842 ]) (vim.cmd "function! VlimeBuildServerCommandFor_my_sbcl(vlime_loader, vlime_eval) return [ \"/usr/bin/sbcl\", \\ \"--load\", a:vlime_loader, \\ \"--eval\", \"(vlime:main :port 52842)\" ] endfunction")) ;; Snippy (use! :dcampos/nvim-snippy :config (let [map (require :snippy.mapping)] (bind! [ :i :s ] : ((. map :next) :)) (bind! [ :i :s ] : (map.previous :)))) ;; nvim-cmp (autocomplete) (use! :hrsh7th/nvim-cmp :requires [ :hrsh7th/cmp-buffer :hrsh7th/cmp-path :hrsh7th/cmp-cmdline :hrsh7th/cmp-nvim-lsp :HiPhish/nvim-cmp-vlime { 1 :ray-x/cmp-treesitter :after :nvim-cmp } :dcampos/cmp-snippy ] :config (module-call! :plugin.cmp :configure)) ;; does what the name says, lets you pick icons (use! :ziontee113/icon-picker.nvim :cmd [ :IconPickerNormal :IconPickerYank ] :setup (bind! :n :ci "IconPickerNormal") (bind! :n :cy "IconPickerYank") :config (vim.cmd "PackerLoad telescope.nvim") (setup! :icon-picker :disable_legacy_commands true)) (use! :jbyuki/nabla.nvim :module :nabla :setup (bind! :n :p #(module-call! :nabla :popup))) ;; guess style from buffer (use! :NMAC427/guess-indent.nvim :config (setup! :guess-indent :auto_cmd true)) ;; formatter (use! :mhartington/formatter.nvim :cmd [ :Format :FormatWrite ] :setup (bind! :n :o "Format") (bind! :x :o ":Format") :config (setup! :formatter :logging true :log_level _G.vim.log.levels.WARN :filetype { :c [ (module-fn! :formatter.filetypes.c :astyle) ] :cpp [ (module-fn! :formatter.filetypes.cpp :astyle) ] :cmake [ (module-fn! :formatter.filetypes.cmake :cmakeformat) ] :java [ (fn [] {:exe :astyle :stdin true :args [ :--mode=java ]}) ] :sh [ (module-fn! :formatter.filetypes.sh :shfmt) ] :rust [ (module-fn! :formatter.filetypes.rust :rustfmt) ] :tex [ (module-fn! :formatter.filetypes.latex :latexindent) ] :python [ (module-fn! :formatter.filetypes.python :yapf) ] :json [ (module-fn! :formatter.filetypes.json :prettier) ] :html [ (module-fn! :formatter.filetypes.html :prettier) ] :css [ (module-fn! :formatter.filetypes.css :prettier) ] :javascript [ (module-fn! :formatter.filetypes.javascript :prettier) ] :markdown [ (module-fn! :formatter.filetypes.markdown :prettier ) ] :fennel [ (fn [] {:exe :fnlfmt :stdin true :args [ "-" ]}) ]})) ;; lspconfig (use! :neovim/nvim-lspconfig :after :cmp-nvim-lsp :config (module-call! :plugin.lsp :configure)) (use! :j-hui/fidget.nvim :after :nvim-lspconfig :config (setup! :fidget)) ;; nvim-jdtls (use! :mfussenegger/nvim-jdtls :ft :java :after :nvim-lspconfig :config (module-call! :plugin.jdtls :configure)) ;; Sync all packages on first launch (if _G.first_launch (module-call! :packer :sync)))