summaryrefslogtreecommitdiff
path: root/fnl
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-02-22 13:07:11 +0100
committerMike Vink <mike1994vink@gmail.com>2023-02-22 13:07:11 +0100
commit62856a0b3d27dfd9e7e64e9c3bdb7a52701939d5 (patch)
tree9d02f82e4b98ee09924caac56a4e353c812bd519 /fnl
parent2806d71d1db594107d156b8c9ceb1c5a98227091 (diff)
add lsp_lines
Diffstat (limited to 'fnl')
-rw-r--r--fnl/conf/diagnostic.fnl6
-rw-r--r--fnl/conf/lsp.fnl4
-rw-r--r--fnl/conf/pkgs.fnl1
-rw-r--r--fnl/conf/pkgs/cmp.fnl42
-rw-r--r--fnl/conf/pkgs/lsp_lines.fnl2
-rw-r--r--fnl/conf/pkgs/lspconfig.fnl7
-rw-r--r--fnl/conf/pkgs/null-ls.fnl2
-rw-r--r--fnl/conf/pkgs/treesitter.fnl2
8 files changed, 42 insertions, 24 deletions
diff --git a/fnl/conf/diagnostic.fnl b/fnl/conf/diagnostic.fnl
index b88a3d5..570e1f5 100644
--- a/fnl/conf/diagnostic.fnl
+++ b/fnl/conf/diagnostic.fnl
@@ -3,3 +3,9 @@
(m :n :<leader>ge (fn []
(vim.diagnostic.open_float)))
+
+(vim.diagnostic.config {:virtual_text false})
+
+(vim.keymap.set :n :<Leader>l (let [l (require :lsp_lines)]
+ l.toggle)
+ {:desc "Toggle lsp_lines"})
diff --git a/fnl/conf/lsp.fnl b/fnl/conf/lsp.fnl
index 31dce3a..0a35fae 100644
--- a/fnl/conf/lsp.fnl
+++ b/fnl/conf/lsp.fnl
@@ -43,8 +43,8 @@
(vim.lsp.diagnostic.on_publish_diagnostics _ result ctx
config)
(vim.diagnostic.setloclist {:open false}))
- {:virtual_text true
- :underline false
+ {:virtual_text false
+ :underline true
:update_in_insert false
:severity_sort true}))
{: client : buf})
diff --git a/fnl/conf/pkgs.fnl b/fnl/conf/pkgs.fnl
index a126eca..af6998a 100644
--- a/fnl/conf/pkgs.fnl
+++ b/fnl/conf/pkgs.fnl
@@ -6,3 +6,4 @@
(require :conf.pkgs.conjure)
(require :conf.pkgs.test)
(require :conf.pkgs.trouble)
+(require :conf.pkgs.lsp_lines)
diff --git a/fnl/conf/pkgs/cmp.fnl b/fnl/conf/pkgs/cmp.fnl
index db3cbf9..461aba1 100644
--- a/fnl/conf/pkgs/cmp.fnl
+++ b/fnl/conf/pkgs/cmp.fnl
@@ -1,14 +1,28 @@
-(let [cmp (require :cmp)
- luasnip (require :luasnip)
- snip (fn [args]
- (luasnip.lsp_expand (. args :body)))]
- (cmp.setup {:snippet {:expand snip}
- :completion {:autocomplete false}
- :mapping (cmp.mapping.preset.insert {:<C-b> (cmp.mapping.scroll_docs -4)
- :<C-f> (cmp.mapping.scroll_docs 4)
- :<C-A> (cmp.mapping.complete)
- :<C-e> (cmp.mapping.confirm {:select true})})
- :sources (cmp.config.sources [{:name :conjure}
- {:name :nvim_lsp}
- {:name :path}
- {:name :luasnip}])}))
+(fn cmp-setup [cmp autocomplete]
+ (let [luasnip (require :luasnip)
+ snip (fn [args]
+ (luasnip.lsp_expand (. args :body)))]
+ (local cfg
+ {:snippet {:expand snip}
+ :mapping (cmp.mapping.preset.insert {:<C-b> (cmp.mapping.scroll_docs -4)
+ :<C-f> (cmp.mapping.scroll_docs 4)
+ :<C-A> (cmp.mapping.complete)
+ :<C-e> (cmp.mapping.confirm {:select true})})
+ :sources (cmp.config.sources [{:name :conjure}
+ {:name :nvim_lsp}
+ {:name :path}
+ {:name :luasnip}])})
+ (if (not autocomplete) (tset cfg :completion {:autocomplete false}))
+ ;; (print (vim.inspect cfg))
+ (cmp.setup cfg)))
+
+(var autocomplete-flag false)
+(fn toggle-autocomplete []
+ (if autocomplete-flag
+ (set autocomplete-flag false)
+ (set autocomplete-flag true))
+ (match (pcall require :cmp)
+ (true cmp) (cmp-setup cmp autocomplete-flag)
+ (false cmp) (print "Something went wrong")))
+
+(toggle-autocomplete)
diff --git a/fnl/conf/pkgs/lsp_lines.fnl b/fnl/conf/pkgs/lsp_lines.fnl
new file mode 100644
index 0000000..7194bd9
--- /dev/null
+++ b/fnl/conf/pkgs/lsp_lines.fnl
@@ -0,0 +1,2 @@
+(let [l (require :lsp_lines)]
+ (l.setup))
diff --git a/fnl/conf/pkgs/lspconfig.fnl b/fnl/conf/pkgs/lspconfig.fnl
index fefef09..518e1f7 100644
--- a/fnl/conf/pkgs/lspconfig.fnl
+++ b/fnl/conf/pkgs/lspconfig.fnl
@@ -9,10 +9,7 @@
(vim.fn.getcwd))
:on_attach attach})
-(lspconfig.yamlls.setup {:root_dir (lspconfig.util.root_pattern :.git
- (vim.fn.getcwd))
- :on_attach attach})
-
(lspconfig.gopls.setup {:root_dir (lspconfig.util.root_pattern :.git
(vim.fn.getcwd))
- :on_attach attach})
+ :on_attach attach
+ :settings {:gopls {:buildFlags ["-tags=all"]}}})
diff --git a/fnl/conf/pkgs/null-ls.fnl b/fnl/conf/pkgs/null-ls.fnl
index 5a540a0..858d0d3 100644
--- a/fnl/conf/pkgs/null-ls.fnl
+++ b/fnl/conf/pkgs/null-ls.fnl
@@ -6,8 +6,6 @@
:sources [null-ls.builtins.formatting.black
null-ls.builtins.formatting.goimports
null-ls.builtins.formatting.gofumpt
- null-ls.builtins.formatting.golines
- null-ls.builtins.formatting.prettier
null-ls.builtins.formatting.raco_fmt
null-ls.builtins.formatting.alejandra
null-ls.builtins.formatting.terraform_fmt
diff --git a/fnl/conf/pkgs/treesitter.fnl b/fnl/conf/pkgs/treesitter.fnl
index 8d7534a..c613be0 100644
--- a/fnl/conf/pkgs/treesitter.fnl
+++ b/fnl/conf/pkgs/treesitter.fnl
@@ -1,2 +1,2 @@
(let [ts (require :nvim-treesitter.configs)]
- (ts.setup {:highlight {:enable true :disable [:bash]}}))
+ (ts.setup {:highlight {:enable true}}))