Compare commits
25 Commits
7cd72735f2
...
main
Author | SHA1 | Date | |
---|---|---|---|
8e47d8bb63
|
|||
cbd4303b7f
|
|||
68f340ced5
|
|||
dbaba9e0f8
|
|||
0ef8abb561
|
|||
28a9ee34a4
|
|||
c670bf843f
|
|||
a6a553c6b0
|
|||
7ae183d64b
|
|||
77b6768742
|
|||
fc3f3415a3
|
|||
9428d38317
|
|||
1a26f6ccd6
|
|||
90fcd5db92
|
|||
3a87627581
|
|||
9e00218179
|
|||
f8ee7b4ee9
|
|||
46d1d9092d
|
|||
2880b96499
|
|||
6b53868291
|
|||
ca21ebc84d
|
|||
198ad1377f
|
|||
d37c20404d
|
|||
101360066e
|
|||
2dcd58be3e
|
@ -1,7 +1,7 @@
|
|||||||
;;; macros.fnl - useful macros
|
;;; macros.fnl - useful macros
|
||||||
|
|
||||||
;; Helpful keymaping functions
|
;; Helpful keymaping functions
|
||||||
(lambda bind! [mode key cmd ?a1 ?a2]
|
(lambda bind! [modes key cmd ?a1 ?a2]
|
||||||
(let [desc (or ?a2 ?a1)
|
(let [desc (or ?a2 ?a1)
|
||||||
buf (if (and ?a1 ?a2) ?a1 ?a2)
|
buf (if (and ?a1 ?a2) ?a1 ?a2)
|
||||||
opts { :noremap true
|
opts { :noremap true
|
||||||
@ -9,7 +9,12 @@
|
|||||||
:buffer buf }]
|
:buffer buf }]
|
||||||
(when desc
|
(when desc
|
||||||
(tset opts :desc desc))
|
(tset opts :desc desc))
|
||||||
`(vim.keymap.set ,mode ,key ,cmd ,opts)))
|
(if (table? modes)
|
||||||
|
(let [output {}]
|
||||||
|
(each [_ mode (ipairs modes)]
|
||||||
|
(table.insert output `(vim.keymap.set ,mode ,key ,cmd ,opts)))
|
||||||
|
output)
|
||||||
|
`(vim.keymap.set ,modes ,key ,cmd ,opts))))
|
||||||
|
|
||||||
;; Better autocommands
|
;; Better autocommands
|
||||||
(lambda hook! [hooks ?patterns callback]
|
(lambda hook! [hooks ?patterns callback]
|
||||||
@ -21,7 +26,7 @@
|
|||||||
(= (type ?patterns) :table)
|
(= (type ?patterns) :table)
|
||||||
?patterns
|
?patterns
|
||||||
[ ?patterns ])]
|
[ ?patterns ])]
|
||||||
(var group "config-hook")
|
(var group (.. (tostring (math.random 0 1000000000) "-config-hook")))
|
||||||
(each [_ hook (ipairs hook_table)]
|
(each [_ hook (ipairs hook_table)]
|
||||||
(set group (.. group "-" hook)))
|
(set group (.. group "-" hook)))
|
||||||
(each [_ pattern (ipairs pattern_table)]
|
(each [_ pattern (ipairs pattern_table)]
|
||||||
@ -83,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
|
||||||
|
132
fnl/plugin.fnl
132
fnl/plugin.fnl
@ -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
|
||||||
@ -62,13 +61,15 @@
|
|||||||
:show_buffer_close_icons false
|
:show_buffer_close_icons false
|
||||||
:show_close_icon false }))
|
:show_close_icon false }))
|
||||||
|
|
||||||
|
(use! :nvim-lua/plenary.nvim
|
||||||
|
:opt true
|
||||||
|
:module :plenary)
|
||||||
|
|
||||||
;; telescope (a fuzzy finder)
|
;; telescope (a fuzzy finder)
|
||||||
(use! :nvim-telescope/telescope.nvim
|
(use! :nvim-telescope/telescope.nvim
|
||||||
:cmd :Telescope
|
:cmd :Telescope
|
||||||
:module :telescope
|
:module :telescope
|
||||||
:requires [ { 1 :nvim-lua/plenary.nvim
|
:requires [ { 1 :nvim-telescope/telescope-ui-select.nvim
|
||||||
:opt true }
|
|
||||||
{ 1 :nvim-telescope/telescope-ui-select.nvim
|
|
||||||
:opt true }
|
:opt true }
|
||||||
{ 1 :nvim-telescope/telescope-fzf-native.nvim
|
{ 1 :nvim-telescope/telescope-fzf-native.nvim
|
||||||
:opt true
|
:opt true
|
||||||
@ -84,6 +85,7 @@
|
|||||||
:TroubleToggle
|
:TroubleToggle
|
||||||
:TroubleClose
|
:TroubleClose
|
||||||
:TroubleRefresh ]
|
:TroubleRefresh ]
|
||||||
|
:module :trouble
|
||||||
:config
|
:config
|
||||||
(setup! :trouble))
|
(setup! :trouble))
|
||||||
|
|
||||||
@ -119,21 +121,6 @@
|
|||||||
:config
|
:config
|
||||||
(setup! :Comment))
|
(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)
|
;; illuminate (same symbol highlight)
|
||||||
(use! :RRethy/vim-illuminate
|
(use! :RRethy/vim-illuminate
|
||||||
:config
|
:config
|
||||||
@ -153,18 +140,6 @@
|
|||||||
:IlluminatedWordText
|
: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
|
;; Snippy
|
||||||
(use! :dcampos/nvim-snippy
|
(use! :dcampos/nvim-snippy
|
||||||
:config
|
:config
|
||||||
@ -178,7 +153,6 @@
|
|||||||
:hrsh7th/cmp-path
|
:hrsh7th/cmp-path
|
||||||
:hrsh7th/cmp-cmdline
|
:hrsh7th/cmp-cmdline
|
||||||
:hrsh7th/cmp-nvim-lsp
|
:hrsh7th/cmp-nvim-lsp
|
||||||
:HiPhish/nvim-cmp-vlime
|
|
||||||
{ 1 :ray-x/cmp-treesitter
|
{ 1 :ray-x/cmp-treesitter
|
||||||
:after :nvim-cmp }
|
:after :nvim-cmp }
|
||||||
:dcampos/cmp-snippy ]
|
:dcampos/cmp-snippy ]
|
||||||
@ -201,42 +175,21 @@
|
|||||||
: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))
|
||||||
|
|
||||||
;; formatter
|
;(use! :edluffy/hologram.nvim
|
||||||
(use! :mhartington/formatter.nvim
|
; :config
|
||||||
:cmd [ :Format :FormatWrite ]
|
; (setup! :hologram
|
||||||
:setup
|
; :auto_display true))
|
||||||
(bind! :n :<leader>o "<cmd>Format<cr>")
|
|
||||||
(bind! :x :<leader>o ":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) ]
|
|
||||||
: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
|
;; lspconfig
|
||||||
(use! :neovim/nvim-lspconfig
|
(use! :neovim/nvim-lspconfig
|
||||||
@ -244,18 +197,49 @@
|
|||||||
:config
|
:config
|
||||||
(module-call! :plugin.lsp :configure))
|
(module-call! :plugin.lsp :configure))
|
||||||
|
|
||||||
(use! :j-hui/fidget.nvim
|
;; null-ls.nvim
|
||||||
|
(use! :nvimtools/none-ls.nvim
|
||||||
:after :nvim-lspconfig
|
:after :nvim-lspconfig
|
||||||
:config
|
:config
|
||||||
(setup! :fidget))
|
(module-call! :plugin.lsp :setup-null-ls))
|
||||||
|
|
||||||
;; 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)))
|
||||||
|
@ -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" }])})))}
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
;;; lsp.fnl - lsp configurations
|
;;; lsp.fnl - lsp configurations
|
||||||
|
|
||||||
(import-macros {: bind!} :macros)
|
(import-macros {: bind! : setup!} :macros)
|
||||||
|
|
||||||
(fn on-attach [client buf]
|
(fn on-attach [client buf]
|
||||||
((. (. (require :cmp) :setup) :buffer) {
|
((. (. (require :cmp) :setup) :buffer) {
|
||||||
@ -21,8 +21,16 @@
|
|||||||
(bind! :n :<leader>rn vim.lsp.buf.rename buf)
|
(bind! :n :<leader>rn vim.lsp.buf.rename buf)
|
||||||
(bind! :n :<leader>cn vim.lsp.buf.code_action buf)
|
(bind! :n :<leader>cn vim.lsp.buf.code_action buf)
|
||||||
; (bind! :n :gr vim.lsp.buf.references buf)
|
; (bind! :n :gr vim.lsp.buf.references buf)
|
||||||
;(when client.server_capabilities.documentFormattingProvider
|
(bind! [ :n :v ] :<leader>o
|
||||||
; (bind! :n :<leader>o #(vim.lsp.buf.format { :async true }) buf))
|
#(vim.lsp.buf.format { :filter
|
||||||
|
;; use null-ls for formatting
|
||||||
|
(fn [client] (or
|
||||||
|
(= client.name :null-ls)
|
||||||
|
(= client.name :rust_analyzer)))
|
||||||
|
:async true }) buf)
|
||||||
|
|
||||||
|
;; 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)
|
||||||
@ -36,11 +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)
|
||||||
@ -52,7 +70,7 @@
|
|||||||
|
|
||||||
(fn configure []
|
(fn configure []
|
||||||
(let [lsp (require :lspconfig)
|
(let [lsp (require :lspconfig)
|
||||||
configs (require :lspconfig.configs)
|
;configs (require :lspconfig.configs)
|
||||||
lsp-cap ((. (require :cmp_nvim_lsp) :default_capabilities))
|
lsp-cap ((. (require :cmp_nvim_lsp) :default_capabilities))
|
||||||
lsp-utils (require :plugin.lsp)]
|
lsp-utils (require :plugin.lsp)]
|
||||||
(macro setup-server! [name ...]
|
(macro setup-server! [name ...]
|
||||||
@ -65,8 +83,22 @@
|
|||||||
(set last-key nil))
|
(set last-key nil))
|
||||||
(set last-key val)))
|
(set last-key val)))
|
||||||
`((. (. lsp ,name) :setup) ,opts)))
|
`((. (. lsp ,name) :setup) ,opts)))
|
||||||
(setup-server! :ccls)
|
(setup-server! :clangd
|
||||||
|
:on_attach (fn [client buf]
|
||||||
|
(lsp-utils.on-attach client buf)
|
||||||
|
(bind! :n :go :<cmd>ClangdSwitchSourceHeader<cr> buf))
|
||||||
|
:cmd [ "clangd"
|
||||||
|
"--header-insertion-decorators=0"
|
||||||
|
"--background-index"
|
||||||
|
"--clang-tidy"
|
||||||
|
"--completion-style=bundled"
|
||||||
|
"--function-arg-placeholders"
|
||||||
|
"--header-insertion=never"
|
||||||
|
"--malloc-trim"
|
||||||
|
"--pch-storage=memory"
|
||||||
|
"--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)
|
||||||
@ -83,20 +115,44 @@
|
|||||||
:library (vim.api.nvim_get_runtime_file "" true) }
|
:library (vim.api.nvim_get_runtime_file "" true) }
|
||||||
:telemetry {
|
:telemetry {
|
||||||
:enable false }}})
|
:enable false }}})
|
||||||
(tset configs :fennel_language_server {
|
(setup-server! :fennel_language_server
|
||||||
:default_config {
|
:settings {
|
||||||
:cmd [ "fennel-language-server" ]
|
:fennel {
|
||||||
:filetypes [ "fennel" ]
|
:workspace {
|
||||||
:single_file_support true
|
:library (vim.api.nvim_list_runtime_paths) }
|
||||||
:root_dir (lsp.util.root_pattern "fnl")
|
:diagnostics {
|
||||||
:settings {
|
:globals [ "vim" ] }}})))
|
||||||
:fennel {
|
|
||||||
:workspace {
|
|
||||||
:library (vim.api.nvim_list_runtime_paths) }
|
|
||||||
:diagnostics {
|
|
||||||
:globals [ "vim" ] }}}}})
|
|
||||||
; needed to make it not complain about a nil setup function
|
|
||||||
(if configs.fennel_language_server.setup
|
|
||||||
(setup-server! :fennel_language_server))))
|
|
||||||
|
|
||||||
{ : configure : on-attach : get-data-dir }
|
(fn setup-null-ls []
|
||||||
|
(let [builtins (. (require :null-ls) :builtins)]
|
||||||
|
(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 [
|
||||||
|
builtins.formatting.astyle
|
||||||
|
builtins.formatting.prettier
|
||||||
|
builtins.formatting.yapf
|
||||||
|
builtins.formatting.fnlfmt
|
||||||
|
builtins.formatting.shfmt
|
||||||
|
builtins.formatting.cmake_format
|
||||||
|
builtins.formatting.stylua
|
||||||
|
(builtins.completion.spell.with { :filetypes [ :text
|
||||||
|
:markdown
|
||||||
|
:tex ]})
|
||||||
|
builtins.diagnostics.cmake_lint
|
||||||
|
;;builtins.diagnostics.codespell
|
||||||
|
;;builtins.diagnostics.shellcheck
|
||||||
|
(builtins.diagnostics.glslc.with
|
||||||
|
{ :extra_args [ "--target-env=opengl" ]})])))
|
||||||
|
|
||||||
|
{: configure : on-attach : get-data-dir : setup-null-ls }
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
(bind! :n :<leader>fo "<cmd>Telescope vim_options<cr>")
|
(bind! :n :<leader>fo "<cmd>Telescope vim_options<cr>")
|
||||||
(bind! :n :<leader>c "<cmd>Telescope command_history<cr>")
|
(bind! :n :<leader>c "<cmd>Telescope command_history<cr>")
|
||||||
(bind! :n :<leader>i "<cmd>Telescope find_files<cr>")
|
(bind! :n :<leader>i "<cmd>Telescope find_files<cr>")
|
||||||
(bind! :n :<leader>i "<cmd>Telescope find_files<cr>")
|
|
||||||
(bind! :n :z= "<cmd>Telescope spell_suggest<cr>")
|
(bind! :n :z= "<cmd>Telescope spell_suggest<cr>")
|
||||||
(fn list-git-or-default []
|
(fn list-git-or-default []
|
||||||
(let [code (os.execute "git rev-parse --is-inside-work-tree >/dev/null 2>&1")]
|
(let [code (os.execute "git rev-parse --is-inside-work-tree >/dev/null 2>&1")]
|
||||||
|
17
init.fnl
17
init.fnl
@ -53,13 +53,15 @@
|
|||||||
(set vim.opt.spelloptions :camel)
|
(set vim.opt.spelloptions :camel)
|
||||||
; Allow more freedom with the cursor
|
; Allow more freedom with the cursor
|
||||||
(set vim.opt.virtualedit :block)
|
(set vim.opt.virtualedit :block)
|
||||||
; Disable modeline for security
|
; Enable modelines with modelineexpr off
|
||||||
(set vim.opt.modeline false)
|
(set vim.opt.modeline true)
|
||||||
(set vim.opt.modelines 0)
|
(set vim.opt.modelineexpr false)
|
||||||
; Auto chdir into files' dirs
|
; Auto chdir into files' dirs
|
||||||
;(set vim.opt.autochdir true)
|
;(set vim.opt.autochdir true)
|
||||||
; Enable substitute 'g' flag by default
|
; Enable substitute 'g' flag by default
|
||||||
(set vim.opt.gdefault true)
|
(set vim.opt.gdefault true)
|
||||||
|
(let [ver (vim.version)]
|
||||||
|
(set vim.opt.exrc (or (> ver.major 0) (>= ver.minor 9))))
|
||||||
|
|
||||||
;; Remove trailing whitespace
|
;; Remove trailing whitespace
|
||||||
(fn remove-trailing-whitespace []
|
(fn remove-trailing-whitespace []
|
||||||
@ -79,7 +81,7 @@
|
|||||||
"Enabled Spellcheck"
|
"Enabled Spellcheck"
|
||||||
"Disabled Spellcheck")))))
|
"Disabled Spellcheck")))))
|
||||||
|
|
||||||
;; Enable spell in certian buffers
|
;; Enable spell in certain buffers
|
||||||
(hook! :FileType [ :text :markdown :tex :bib ]
|
(hook! :FileType [ :text :markdown :tex :bib ]
|
||||||
#(if (= (vim.fn.buflisted (vim.api.nvim_get_current_buf)) 1)
|
#(if (= (vim.fn.buflisted (vim.api.nvim_get_current_buf)) 1)
|
||||||
(set vim.opt_local.spell true)))
|
(set vim.opt_local.spell true)))
|
||||||
@ -97,6 +99,11 @@
|
|||||||
:extension {
|
:extension {
|
||||||
"nasm" :nasm
|
"nasm" :nasm
|
||||||
"h" :c
|
"h" :c
|
||||||
"ui" :xml }})
|
"ui" :xml
|
||||||
|
"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))
|
||||||
|
Reference in New Issue
Block a user