This repository has been archived on 2024-10-28. You can view files and clone it, but cannot push or open issues or pull requests.
nvim-config/fnl/plugin.fnl

276 lines
9.2 KiB
Plaintext
Raw Normal View History

2022-11-30 22:27:40 -08:00
;;; plugin.fnl - plugin configurations
(import-macros {: bind! : hook!
: use! : setup!
2023-02-07 10:39:31 -08:00
: module-call!
: module-fn! } :macros)
2022-11-30 22:27:40 -08:00
(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 }))
2022-11-30 22:27:40 -08:00
;; nightfox.nvim (colorscheme)
(use! :EdenEast/nightfox.nvim
:after :nvim-treesitter
:config
(vim.cmd.colorscheme :carbonfox))
2022-11-30 22:27:40 -08:00
;; 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 ]}))
2022-11-30 22:27:40 -08:00
;; 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 }))
2022-11-30 22:27:40 -08:00
;; fzf (a fuzzy finder)
(use! :ibhagwan/fzf-lua
2023-01-01 16:18:50 -08:00
:cmd :FzfLua
:setup
(bind! :n :<leader>fq "<cmd>FzfLua quickfix<cr>")
(bind! :n :<leader>fr "<cmd>FzfLua registers<cr>")
(bind! :n :<leader>fj "<cmd>FzfLua jumps<cr>")
(bind! :n :<leader>fa "<cmd>FzfLua marks<cr>")
(bind! :n :<leader>fh "<cmd>FzfLua help_tags<cr>")
(bind! :n :<leader>g "<cmd>FzfLua live_grep<cr>")
(bind! :n :<leader>fg "<cmd>FzfLua live_grep<cr>")
(bind! :n :<leader>G "<cmd>FzfLua grep<cr>")
(bind! :n :<leader>fG "<cmd>FzfLua grep<cr>")
(bind! :n :<leader>b "<cmd>FzfLua buffers<cr>")
(bind! :n :gb "<cmd>FzfLua buffers<cr>")
(bind! :n :<leader>fu "<cmd>FzfLua git_status<cr>")
(bind! :n :<leader>fm "<cmd>FzfLua man_pages<cr>")
(bind! :n :<leader>fe "<cmd>FzfLua diagnostics_document<cr>")
(bind! :n :<leader>fE "<cmd>FzfLua diagnostics_workspace<cr>")
(bind! :n :<leader>d "<cmd>FzfLua loclist<cr>")
(bind! :n :<leader>fp "<cmd>FzfLua spell_suggest<cr>")
(bind! :n :<leader>i "<cmd>FzfLua files<cr>")
(bind! :n :z= "<cmd>FzfLua spell_suggest<cr>")
2023-02-07 10:39:31 -08:00
(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 "FzfLua git_files")
(vim.cmd "FzfLua files"))))
(bind! :n :<leader>ff list-git-or-default)
(bind! :n :<leader>u list-git-or-default)
2023-01-03 00:24:32 -08:00
(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://")
2023-01-03 00:24:32 -08:00
(table.insert terms name)
(set term_count (+ term_count 1))
(set last_id id))))
(if (= term_count 0)
(vim.cmd.terminal)
2023-01-03 00:24:32 -08:00
(= term_count 1)
(vim.cmd.buffer last_id)
2023-01-01 16:18:50 -08:00
(vim.cmd "FzfLua buffers query=term://")))
2023-01-03 00:24:32 -08:00
(bind! :n :<leader>t jump-or-open-terminal)
:config
(let [fzf (require :fzf-lua)]
(fzf.register_ui_select)))
2022-11-30 22:27:40 -08:00
;; Nvim surround
(use! :kylechui/nvim-surround
:config
(setup! :nvim-surround))
2022-11-30 22:27:40 -08:00
;; Leap
(use! :ggandor/leap.nvim
:after :nvim-treesitter
:config
((. (require :leap) :add_default_mappings))
(bind! :o :z "<plug>(leap-forward-to)")
(bind! :o :Z "<plug>(leap-backward-to)")
(vim.api.nvim_set_hl 0 :LeapBackdrop { :link :Comment }))
2022-11-30 22:27:40 -08:00
;; Leap spooky (remote operations)
(use! :ggandor/leap-spooky.nvim
:after :leap.nvim
:config
(setup! :leap-spooky))
2022-11-30 22:27:40 -08:00
;; Flit (leap for 'till' and 'forward' motions)
(use! :ggandor/flit.nvim
:after :leap.nvim
:config
(setup! :flit))
2022-11-30 22:27:40 -08:00
;; Comment.nvim
(use! :numToStr/Comment.nvim
:config
(setup! :Comment))
2022-11-30 22:27:40 -08:00
;; 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)))
2022-11-30 22:27:40 -08:00
2022-12-07 03:39:47 -08:00
;; illuminate (same symbol highlight)
2022-11-30 22:27:40 -08:00
(use! :RRethy/vim-illuminate
:config
(module-call! :illuminate :configure)
{ :providers [
"lsp"
"treesitter"
"ragex" ]
:modes_denylist [
:markdown
:text
:gitconfig
:gitignore ]
:delay 0 }
(hook! :FileType :lua #(vim.api.nvim_set_hl 0
:IlluminatedWordText
{})))
2022-11-30 22:27:40 -08:00
2022-12-07 03:39:47 -08:00
;; vlime (lisp environment)
(use! :vlime/vlime
2023-01-01 16:18:50 -08:00
: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"))
2022-12-07 03:39:47 -08:00
2022-11-30 22:27:40 -08:00
;; Snippy
(use! :dcampos/nvim-snippy
:config
(let [map (require :snippy.mapping)]
(bind! [ :i :s ] :<tab> ((. map :next) :<tab>))
(bind! [ :i :s ] :<s-tab> (map.previous :<tab>))))
2022-11-30 22:27:40 -08:00
;; nvim-cmp (autocomplete)
(use! :hrsh7th/nvim-cmp
:requires [ :hrsh7th/cmp-buffer
:hrsh7th/cmp-path
:hrsh7th/cmp-cmdline
:hrsh7th/cmp-nvim-lsp
2022-12-07 03:39:47 -08:00
:HiPhish/nvim-cmp-vlime
2022-11-30 22:27:40 -08:00
{ 1 :ray-x/cmp-treesitter
:after :nvim-cmp }
:dcampos/cmp-snippy ]
:config
(module-call! :plugin.cmp :configure))
2022-11-30 22:27:40 -08:00
2023-01-01 16:18:50 -08:00
;; does what the name says, lets you pick icons
2022-12-31 01:45:54 -08:00
(use! :ziontee113/icon-picker.nvim
2023-01-01 16:18:50 -08:00
:cmd [ :IconPickerNormal :IconPickerYank ]
:setup
(bind! :n :<leader>ci "<cmd>IconPickerNormal<cr>")
(bind! :n :<leader>cy "<cmd>IconPickerYank<cr>")
2022-12-31 01:45:54 -08:00
:config
2023-01-01 16:18:50 -08:00
(vim.cmd "PackerLoad fzf-lua")
2022-12-31 01:45:54 -08:00
(setup! :icon-picker
2023-01-01 16:18:50 -08:00
:disable_legacy_commands true))
2022-12-31 01:45:54 -08:00
2023-02-05 15:54:06 -08:00
(use! :jbyuki/nabla.nvim
:module :nabla
:setup
(bind! :n :<leader>p #(module-call! :nabla :popup)))
2022-12-09 00:23:02 -08:00
;; guess style from buffer
(use! :NMAC427/guess-indent.nvim
:config
(setup! :guess-indent :auto_cmd true))
2022-12-09 00:23:02 -08:00
2023-02-07 10:39:31 -08:00
;; formatter
(use! :mhartington/formatter.nvim
:cmd [ :Format :FormatWrite ]
:setup
(bind! :n :<leader>o "<cmd>Format<cr>")
: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) ]
:fennel [
(fn [] {:exe :fnlfmt
:stdin true
:args [ "-" ]}) ]}))
2022-11-30 22:27:40 -08:00
;; lspconfig
(use! :neovim/nvim-lspconfig
2023-01-01 16:18:50 -08:00
:after :cmp-nvim-lsp
:config
(module-call! :plugin.lsp :configure))
2022-11-30 22:27:40 -08:00
2023-02-06 12:53:11 -08:00
(use! :j-hui/fidget.nvim
:after :nvim-lspconfig
:config
(setup! :fidget))
2022-11-30 22:27:40 -08:00
;; nvim-jdtls
(use! :mfussenegger/nvim-jdtls
:after :nvim-lspconfig
:config
(module-call! :plugin.jdtls :configure))
2022-11-30 22:27:40 -08:00
;; Sync all packages on first launch
(if _G.first_launch
(module-call! :packer :sync)))