Compare commits

...

17 Commits

5 changed files with 98 additions and 33 deletions

View File

@ -88,7 +88,8 @@
`(use ,output)) `(use ,output))
;; Call a plugin's `setup function' ;; Call a plugin's `setup function'
(lambda setup! [pkg ...] (local output [ ]) (lambda setup! [pkg ...]
(local output [ ])
(var last_key nil) (var last_key nil)
(each [_ val (ipairs [...])] (each [_ val (ipairs [...])]
(if last_key (if last_key

View File

@ -12,6 +12,12 @@
;; tangerine.nvim (auto fennel compile) ;; tangerine.nvim (auto fennel compile)
(use! :udayvir-singh/tangerine.nvim) (use! :udayvir-singh/tangerine.nvim)
;; hy syntax
(use! :hylang/vim-hy)
;; rainbow delimiters
(use! :HiPhish/rainbow-delimiters.nvim)
;; Treesitter ;; Treesitter
(use! :nvim-treesitter/nvim-treesitter (use! :nvim-treesitter/nvim-treesitter
:config :config
@ -41,14 +47,7 @@
:config :config
(setup! :lualine (setup! :lualine
:options { :section_separators "" :options { :section_separators ""
:component_separators "│" } :component_separators "│" }))
; :sections { :lualine_x [
; { 1 #(.. "recording @" (vim.fn.reg_recording))
; :cond #(not= (# (vim.fn.reg_recording)) 0) }
; :encoding
; :fileformat
; :filetype ]}
))
;; bufferline.nvim ;; bufferline.nvim
(use! :akinsho/bufferline.nvim (use! :akinsho/bufferline.nvim
@ -86,6 +85,7 @@
:TroubleToggle :TroubleToggle
:TroubleClose :TroubleClose
:TroubleRefresh ] :TroubleRefresh ]
:module :trouble
:config :config
(setup! :trouble)) (setup! :trouble))
@ -175,34 +175,71 @@
:setup :setup
(bind! :n :<leader>p #(module-call! :nabla :popup))) (bind! :n :<leader>p #(module-call! :nabla :popup)))
; oil (file manager)
(use! :stevearc/oil.nvim
:config
(setup! :oil
:columns [ :icon :permissions :size: :mtime ]))
;; guess style from buffer ;; guess style from buffer
(use! :NMAC427/guess-indent.nvim (use! :NMAC427/guess-indent.nvim
:config :config
(setup! :guess-indent :auto_cmd true)) (setup! :guess-indent :auto_cmd true))
;(use! :edluffy/hologram.nvim
; :config
; (setup! :hologram
; :auto_display true))
;; lspconfig ;; lspconfig
(use! :neovim/nvim-lspconfig (use! :neovim/nvim-lspconfig
:after :cmp-nvim-lsp :after :cmp-nvim-lsp
:config :config
(module-call! :plugin.lsp :configure)) (module-call! :plugin.lsp :configure))
(use! :jose-elias-alvarez/null-ls.nvim ;; null-ls.nvim
(use! :nvimtools/none-ls.nvim
:after :nvim-lspconfig :after :nvim-lspconfig
:config :config
(module-call! :plugin.lsp :setup-null-ls)) (module-call! :plugin.lsp :setup-null-ls))
(use! :j-hui/fidget.nvim
:after :nvim-lspconfig
:config
(setup! :fidget))
;; nvim-jdtls ;; nvim-jdtls
(use! :mfussenegger/nvim-jdtls (use! :mfussenegger/nvim-jdtls
:ft :java
:after :nvim-lspconfig
:config :config
(module-call! :plugin.jdtls :configure)) (module-call! :plugin.jdtls :configure))
;; formatter.nvim
;(use! :mhartington/formatter.nvim
; :cmd [ :Format :FormatWrite ]
; :setup
; (bind! :n :<leader>o "<cmd>Format<cr>")
; (bind! :v :<leader>o ":Format<cr>")
; :config
; (setup! :formatter
; :logging true
; :log_level _G.vim.log.levels.WA;RN
; :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 [ "-" ]})]}))
;; Sync all packages on first launch ;; Sync all packages on first launch
(if _G.first_launch (if _G.first_launch
(module-call! :packer :sync))) (module-call! :packer :sync)))

View File

@ -155,14 +155,13 @@
{ :behavior cmp.SelectBehavior.Select }) { :behavior cmp.SelectBehavior.Select })
(fallback))) (fallback)))
[ :i :c ])}] [ :i :c ])}]
(cmp.setup.cmdline "/" ;(cmp.setup.cmdline "/"
{ :completion { :autocomplete true } ; { :completion { :autocomplete true }
:mapping cmdline-mappings ; :mapping cmdline-mappings
:sources (cmp.config.sources ; :sources (cmp.config.sources
[{ :name "buffer" }])}) ; [{ :name "buffer" }])})
(cmp.setup.cmdline ":" (cmp.setup.cmdline ":"
{ :completion { :autocomplete false } { :completion { :autocomplete false }
:mapping cmdline-mappings :mapping cmdline-mappings
:sources (cmp.config.sources :sources (cmp.config.sources
[{ :name "cmdline" } [{ :name "cmdline" }])})))}
{ :name "path" }])})))}

View File

@ -28,7 +28,9 @@
(= client.name :null-ls) (= client.name :null-ls)
(= client.name :rust_analyzer))) (= client.name :rust_analyzer)))
:async true }) buf) :async true }) buf)
(vim.api.nvim_buf_set_option buf :formatexpr "v:lua.vim.lsp.formatexpr()")
;; Use builtin formatexpr
(vim.api.nvim_buf_set_option buf :formatexpr "")
;; Some telescope commands ;; Some telescope commands
(bind! :n :<leader>s "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>" buf) (bind! :n :<leader>s "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>" buf)
@ -42,10 +44,21 @@
(bind! :n :gd "<cmd>Telescope lsp_definitions<cr>" buf) (bind! :n :gd "<cmd>Telescope lsp_definitions<cr>" buf)
(bind! :n :gI "<cmd>Telescope lsp_implementations<cr>" buf) (bind! :n :gI "<cmd>Telescope lsp_implementations<cr>" buf)
(bind! :n :D "<cmd>Telescope lsp_type_definitions<cr>" buf) (bind! :n :D "<cmd>Telescope lsp_type_definitions<cr>" buf)
(bind! :n :<leader>fq "<cmd>Telescope diagnostics<cr>" buf)
;; Some trouble commands ;; Some trouble commands
(bind! :n :<leader>q "<cmd>TroubleToggle document_diagnostics<cr>") (bind! :n :<leader>q (fn []
(bind! :n :<leader>Q "<cmd>TroubleToggle workspace_diagnostics<cr>")) (let [trouble (require :trouble)]
(if (trouble.is_open)
(trouble.close)
true
(trouble.open :document_diagnostics)))))
(bind! :n :<leader>Q (fn []
(let [trouble (require :trouble)]
(if (trouble.is_open)
(trouble.close)
true
(trouble.open :workspace_diagnostics))))))
(fn get-data-dir [server root] (fn get-data-dir [server root]
(let [resolved_path (vim.fn.resolve root) (let [resolved_path (vim.fn.resolve root)
@ -85,6 +98,7 @@
"--pch-storage=memory" "--pch-storage=memory"
"--offset-encoding=utf-16" ]) "--offset-encoding=utf-16" ])
(setup-server! :cmake) (setup-server! :cmake)
(setup-server! :vala_ls)
(setup-server! :gopls) (setup-server! :gopls)
(setup-server! :rust_analyzer) (setup-server! :rust_analyzer)
(setup-server! :texlab) (setup-server! :texlab)
@ -112,6 +126,18 @@
(fn setup-null-ls [] (fn setup-null-ls []
(let [builtins (. (require :null-ls) :builtins)] (let [builtins (. (require :null-ls) :builtins)]
(setup! :null-ls (setup! :null-ls
:on_attach (fn [client buf]
(bind! [ :n :v ]
:<leader>o
#(vim.lsp.buf.format
{ :filter
;; use null-ls for formatting
(fn [client]
(or
(= client.name :null-ls)
(= client.name :rust_analyzer)))
:async true }) buf)
(vim.api.nvim_buf_set_option buf :formatexpr ""))
:sources [ :sources [
builtins.formatting.astyle builtins.formatting.astyle
builtins.formatting.prettier builtins.formatting.prettier
@ -119,15 +145,13 @@
builtins.formatting.fnlfmt builtins.formatting.fnlfmt
builtins.formatting.shfmt builtins.formatting.shfmt
builtins.formatting.cmake_format builtins.formatting.cmake_format
builtins.formatting.latexindent
builtins.formatting.stylua builtins.formatting.stylua
builtins.code_actions.shellcheck
(builtins.completion.spell.with { :filetypes [ :text (builtins.completion.spell.with { :filetypes [ :text
:markdown :markdown
:tex ]}) :tex ]})
builtins.diagnostics.cmake_lint builtins.diagnostics.cmake_lint
builtins.diagnostics.codespell ;;builtins.diagnostics.codespell
builtins.diagnostics.shellcheck ;;builtins.diagnostics.shellcheck
(builtins.diagnostics.glslc.with (builtins.diagnostics.glslc.with
{ :extra_args [ "--target-env=opengl" ]})]))) { :extra_args [ "--target-env=opengl" ]})])))

View File

@ -100,6 +100,10 @@
"nasm" :nasm "nasm" :nasm
"h" :c "h" :c
"ui" :xml "ui" :xml
"tpp" :cpp }}) "tpp" :cpp
"m" :objc }})
;; Fix filetype of terminal buffers
(hook! :BufEnter "term:/*" #(set vim.bo.filetype ""))
(module-call! :packer :startup (require :plugin)) (module-call! :packer :startup (require :plugin))