This commit is contained in:
Talon 2023-07-29 09:21:07 -06:00
parent a34700b8bf
commit 5613801fa3
5 changed files with 148 additions and 183 deletions

View file

@ -1,52 +1,41 @@
;; Package Management via lazy.nvim ;; Package Management via lazy.nvim
(let (let [lazy (require :lazy)
[lazy (require :lazy) lazypath (.. (vim.fn.stdpath :data) :/lazy/lazy.nvim)]
lazypath (.. (vim.fn.stdpath "data") "/lazy/lazy.nvim")
]
(if (not (vim.loop.fs_stat lazypath)) (if (not (vim.loop.fs_stat lazypath))
(vim.fn.system (vim.fn.system [:git
["git" :clone
"clone"
"--filter=blob:none" "--filter=blob:none"
"https://github.com/folke/lazy.nvim.git" "https://github.com/folke/lazy.nvim.git"
"--branch=stable" :--branch=stable
lazypath])) lazypath]))
(vim.opt.rtp:prepend lazypath) (vim.opt.rtp:prepend lazypath)
(lazy.setup (lazy.setup ["https://github.com/rktjmp/hotpot.nvim"
["https://github.com/rktjmp/hotpot.nvim"
{:url "https://github.com/nvim-telescope/telescope.nvim" {:url "https://github.com/nvim-telescope/telescope.nvim"
:tag "0.1.2" :tag :0.1.2
:dependencies ["nvim-lua/plenary.nvim"]} :dependencies [:nvim-lua/plenary.nvim]}
{:url "https://github.com/nvim-telescope/telescope-fzf-native.nvim" {:url "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
:build (.. "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release" :build (.. "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release"
" && cmake --build build --config Release" " && cmake --build build --config Release"
" && cmake --install build --prefix build" )} " && cmake --install build --prefix build")}
{:url "https://github.com/nvim-treesitter/nvim-treesitter" {:url "https://github.com/nvim-treesitter/nvim-treesitter"
:build ":TSUpdate"} :build ":TSUpdate"}
{:url "https://github.com/neovim/nvim-lspconfig" {:url "https://github.com/neovim/nvim-lspconfig"
:dependencies :dependencies ["https://github.com/williamboman/mason.nvim"
["https://github.com/williamboman/mason.nvim" :williamboman/mason-lspconfig.nvim
"williamboman/mason-lspconfig.nvim"
{:url "https://github.com/j-hui/fidget.nvim" {:url "https://github.com/j-hui/fidget.nvim"
:tag "legacy" :tag :legacy
:opts {}} :opts {}}
"folke/neodev.nvim" :folke/neodev.nvim]}
]}
{:url "https://github.com/hrsh7th/nvim-cmp" {:url "https://github.com/hrsh7th/nvim-cmp"
:dependencies :dependencies ["https://github.com/hrsh7th/cmp-nvim-lsp"
["https://github.com/hrsh7th/cmp-nvim-lsp"
"https://github.com/hrsh7th/cmp-buffer" "https://github.com/hrsh7th/cmp-buffer"
"https://github.com/hrsh7th/cmp-path" "https://github.com/hrsh7th/cmp-path"
"https://github.com/hrsh7th/cmp-cmdline" "https://github.com/hrsh7th/cmp-cmdline"
"https://github.com/hrsh7th/cmp-cmdline" "https://github.com/hrsh7th/cmp-cmdline"]}
]}
{:url "https://github.com/L3MON4D3/LuaSnip" {:url "https://github.com/L3MON4D3/LuaSnip"
:dependencies :dependencies ["https://github.com/saadparwaiz1/cmp_luasnip"
[{:url "https://github.com/saadparwaiz1/cmp_luasnip"} "https://github.com/rafamadriz/friendly-snippets"]}
{:url "https://github.com/rafamadriz/friendly-snippets"} "https://github.com/sainnhe/everforest"]))
]}
"https://github.com/sainnhe/everforest"
]))
(let [telescope (require :telescope)] (let [telescope (require :telescope)]
(pcall (telescope.load_extension :fzf))) (pcall (telescope.load_extension :fzf)))

View file

@ -1,7 +1,5 @@
(let (let [cmp (require :cmp)
[cmp (require :cmp) luasnip (require :luasnip)]
luasnip (require :luasnip)
]
{:options (fn [] {:options (fn []
(set vim.o.termguicolors true) (set vim.o.termguicolors true)
(set vim.o.mouse :a) (set vim.o.mouse :a)
@ -9,61 +7,56 @@
(set vim.o.wrap false) (set vim.o.wrap false)
(set vim.opt.colorcolumn "80,120") (set vim.opt.colorcolumn "80,120")
(vim.cmd.colorscheme :everforest)) (vim.cmd.colorscheme :everforest))
:keymap (fn [] :keymap (fn []
(let [nmap #(vim.keymap.set [:n] $1 $2 {:desc $3})] (let [nmap #(vim.keymap.set [:n] $1 $2 {:desc $3})]
(nmap "<Tab>" ":bnext<CR>" "Next Buffer") (nmap :<Tab> ":bnext<CR>" "Next Buffer")
(nmap "<S-Tab>" ":bprevious<CR>" "Previous Buffer") (nmap :<S-Tab> ":bprevious<CR>" "Previous Buffer")
(nmap "<C-X>" ":write|bdelete<CR>" "Save and delete buffer") (nmap :<C-X> ":write|bdelete<CR>" "Save and delete buffer")
(nmap "<C-P>" ":Telescope find_files<CR>" "Telescope find_files") (nmap :<C-P> ":Telescope find_files<CR>" "Telescope find_files")
(nmap "<C-F>" ":Telescope live_grep<CR>" "Telescope live_grep") (nmap :<C-F> ":Telescope live_grep<CR>" "Telescope live_grep")
(nmap "<C-B>" ":Telescope buffers<CR>" "Telescope buffers") (nmap :<C-B> ":Telescope buffers<CR>" "Telescope buffers")
(nmap "<C-T>" ":Telescope treesitter<CR>" "Telescope treesitter"))) (nmap :<C-T> ":Telescope treesitter<CR>" "Telescope treesitter")))
:treesitter-languages [:c
:treesitter-languages :lua
[:c :lua :vim :vimdoc :query ; required :vim
:fennel] ; add new languages here :vimdoc
:query
:language-servers :fennel]
{:lua_ls {:filetypes [:lua] :language-servers {:lua_ls {:filetypes [:lua]
:Lua :Lua {:workspace {:checkThirdParty false}}
{:workspace {:checkThirdParty false}}
:telemetry {:enable false} :telemetry {:enable false}
:diagnostics {:globals :diagnostics {:globals [:vim]}}
[:vim
]}}
:fennel_language_server {:filetypes [:fennel] :fennel_language_server {:filetypes [:fennel]
:fennel :fennel {:workspace {:library (vim.api.nvim_list_runtime_paths)}
{:workspace {:library (vim.api.nvim_list_runtime_paths)} :diagnostics {:globals [:vim]}}}
:diagnostics {:globals
[:vim
]}}}
:bashls {:filetypes [:bash]}} :bashls {:filetypes [:bash]}}
:lsp-attach (fn [_ bufnr] :lsp-attach (fn [_ bufnr]
(let (let [nmap #(vim.keymap.set :n $1 $2
[nmap #(vim.keymap.set :n $1 $2 {:buffer bufnr :desc (.. "LSP: " $3)}) {:buffer bufnr
telescope (require :telescope.builtin) :desc (.. "LSP: " $3)})
] telescope (require :telescope.builtin)]
(nmap :gd vim.lsp.buf.definition "[G]o to [D]efiniton") (nmap :gd vim.lsp.buf.definition "[G]o to [D]efiniton")
(nmap :gr telescope.lsp_references "[G]o to [R]eferences") (nmap :gr telescope.lsp_references "[G]o to [R]eferences")
(nmap :gI vim.lsp.buf.implementation "[G]o to [I]mplementation") (nmap :gI vim.lsp.buf.implementation
(vim.api.nvim_buf_create_user_command bufnr "Format" "[G]o to [I]mplementation")
(vim.api.nvim_buf_create_user_command bufnr :Format
#(vim.lsp.buf.format) #(vim.lsp.buf.format)
"Format current buffer with LSP"))) "Format current buffer with LSP")))
:cmp-mapping {:<C-j> (cmp.mapping.select_next_item)
:cmp-mapping
{:<C-j> (cmp.mapping.select_next_item)
:<C-k> (cmp.mapping.select_prev_item) :<C-k> (cmp.mapping.select_prev_item)
:<C-d> (cmp.mapping.scroll_docs -4) :<C-d> (cmp.mapping.scroll_docs -4)
:<C-f> (cmp.mapping.scroll_docs 4) :<C-f> (cmp.mapping.scroll_docs 4)
:<C-Space> (cmp.mapping.complete) :<C-Space> (cmp.mapping.complete)
:<CR> (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Replace :select true}) :<CR> (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Replace
:select true})
:<Tab> (cmp.mapping (fn [fallback] :<Tab> (cmp.mapping (fn [fallback]
(if (cmp.visible) (cmp.select_prev_item) (if (cmp.visible) (cmp.select_prev_item)
(luasnip.expand_or_locally_jumpable) (luasnip.expand_or_jump) (luasnip.expand_or_locally_jumpable) (luasnip.expand_or_jump)
(fallback))) [:i :s]) (fallback)))
[:i :s])
:<S-Tab> (cmp.mapping (fn [fallback] :<S-Tab> (cmp.mapping (fn [fallback]
(if (cmp.visible) (cmp.select_prev_item) (if (cmp.visible)
(luasnip.locally_jumpable -1) (luasnip.jump -1) (cmp.select_prev_item)
(fallback))) [:i :s])}}) (luasnip.locally_jumpable -1)
(luasnip.jump -1) (fallback)))
[:i :s])}})

View file

@ -1,32 +1,22 @@
(let (let [cmp (require :cmp)
[cmp (require :cmp)
luasnip (require :luasnip) luasnip (require :luasnip)
vscode-snips (require :luasnip.loaders.from_vscode) vscode-snips (require :luasnip.loaders.from_vscode)
{: cmp-mapping} (require :personalize) {: cmp-mapping} (require :personalize)]
]
(vscode-snips.lazy_load) (vscode-snips.lazy_load)
(luasnip.config.setup) (luasnip.config.setup)
(cmp.setup (cmp.setup {:snippet {:expand #(luasnip $1)}
{:snippet {:expand #(luasnip $1)}
:mapping (cmp.mapping.preset.insert cmp-mapping) :mapping (cmp.mapping.preset.insert cmp-mapping)
:sources (cmp.config.sources :sources (cmp.config.sources [{:name :nvim_lsp}
[{:name :nvim_lsp}
{:name :luasnip} {:name :luasnip}
{:name :buffer} {:name :buffer}])})
])})
(cmp.setup.cmdline ["/" "?"] (cmp.setup.cmdline ["/" "?"]
{:mapping (cmp.mapping.preset.cmdline) {:mapping (cmp.mapping.preset.cmdline)
:sources :sources [{:name :buffer}]})
[{:name :buffer}]
})
(cmp.setup.cmdline [":"] (cmp.setup.cmdline [":"]
{:mapping (cmp.mapping.preset.cmdline) {:mapping (cmp.mapping.preset.cmdline)
:sources (cmp.config.sources :sources (cmp.config.sources [{:name :path}
[{:name :path}
{:name :cmdline}])}) {:name :cmdline}])})
(cmp.setup.filetype [:gitcommit] (cmp.setup.filetype [:gitcommit]
{:mapping (cmp.mapping.preset.cmdline) {:mapping (cmp.mapping.preset.cmdline)
:sources (cmp.config.sources :sources (cmp.config.sources [{:name :git}
[{:name :git} {:name :buffer}])}))
{:name :buffer}])
}))

View file

@ -1,22 +1,19 @@
(let (let [neodev (require :neodev)
[neodev (require :neodev)
mason (require :mason) mason (require :mason)
mason-lspconfig (require :mason-lspconfig) mason-lspconfig (require :mason-lspconfig)
{: language-servers : lsp-attach} (require :personalize) {: language-servers : lsp-attach} (require :personalize)]
]
(neodev.setup) (neodev.setup)
(mason.setup) (mason.setup)
(mason-lspconfig.setup {:ensure_installed (vim.tbl_keys language-servers)}) (mason-lspconfig.setup {:ensure_installed (vim.tbl_keys language-servers)})
(mason-lspconfig.setup_handlers (mason-lspconfig.setup_handlers
[(fn [server_name] (let [(fn [server_name]
[server (. (require :lspconfig) server_name) (let [server (. (require :lspconfig)
server_name)
cmp-nvim-lsp (require :cmp_nvim_lsp) cmp-nvim-lsp (require :cmp_nvim_lsp)
settings (. language-servers server_name) settings (. language-servers
] server_name)]
(server.setup (server.setup {:capabilities (cmp-nvim-lsp.default_capabilities (vim.lsp.protocol.make_client_capabilities))
{:capabilities (cmp-nvim-lsp.default_capabilities (vim.lsp.protocol.make_client_capabilities))
:on_attach lsp-attach :on_attach lsp-attach
:settings settings : settings
:filetypes (or settings.filetypes [])}))) :filetypes (or settings.filetypes
])) [])})))]))

View file

@ -1,11 +1,7 @@
(let (let [treesitter (require :nvim-treesitter.configs)
[treesitter (require :nvim-treesitter.configs) {: treesitter-languages} (require :personalize)]
{: treesitter-languages} (require :personalize) (treesitter.setup {:ensure_installed treesitter-languages
]
(treesitter.setup
{:ensure_installed treesitter-languages
:sync_install false :sync_install false
:auto_install false :auto_install true
:ignore_install [] ; could :ensure_installed :all, then ignore unwanted.
:highlight {:enable true} :highlight {:enable true}
:indent {:enable true}})) :indent {:enable true}}))