From d79ff1ce134946fb5094bf7e6a43954789e03195 Mon Sep 17 00:00:00 2001 From: elkowar <5300871+elkowar@users.noreply.github.com> Date: Thu, 22 Apr 2021 19:54:37 +0200 Subject: [PATCH] cleanup --- fnl/plugins/lsp.fnl | 46 ++++++++++++++++++--------------------- fnl/plugins/telescope.fnl | 2 +- init.vim | 3 +-- 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/fnl/plugins/lsp.fnl b/fnl/plugins/lsp.fnl index d89f071..7e7cf58 100644 --- a/fnl/plugins/lsp.fnl +++ b/fnl/plugins/lsp.fnl @@ -37,37 +37,33 @@ (local capabilities (vim.lsp.protocol.make_client_capabilities)) (set capabilities.textDocument.completion.completionItem.snippetSupport true) (set capabilities.textDocument.completion.completionItem.resolveSupport - { :properties ["documentation" "detail" "additionalTextEdits"]}) + { :properties ["documentation" "detail" "additionalTextEdits"]}) -(lsp.rust_analyzer.setup { :on_attach on_attach - :capabilities capabilities}) -(lsp.vimls.setup { :on_attach on_attach}) -(lsp.tsserver.setup { :on_attach on_attach :root_dir (lsp.util.root_pattern "package.json")}) -(lsp.bashls.setup { :on_attach on_attach }) -(lsp.html.setup { :on_attach on_attach}) -(lsp.denols.setup { :on_attach on_attach - :root_dir (better_root_pattern [".git"] ["package.json"])}) -(lsp.hls.setup { :on_attach on_attach - :settings { :languageServerHaskell { :formattingProvider "stylish-haskell"}}}) +(fn init-lsp [lsp-name ?opts] + "initialize a language server with defaults" + (let [merged-opts {:on_attach on_attach}] + (each [k v (pairs (or opts {}))] + (tset merged-opts k v)) + ((. lsp lsp-name :setup) merged-opts))) + + +(init-lsp :rust_analyzer { :capabilities capabilities}) +(init-lsp :tsserver { :root_dir (lsp.util.root_pattern "package.json")}) +(init-lsp :jsonls { :commands { :Format [ #(vim.lsp.buf.range_formatting [] [0 0] [(vim.fn.line "$") 0])]}}) +(init-lsp :denols { :root_dir (better_root_pattern [".git"] ["package.json"])}) +(init-lsp :hls { :settings { :languageServerHaskell { :formattingProvider "stylish-haskell"}}}) +(init-lsp :vimls) +(init-lsp :bashls) +(init-lsp :erlangls) +(init-lsp :yamlls) +(init-lsp :html) +(init-lsp :cssls) -(lsp.jsonls.setup - { :on_attach on_attach - :commands { :Format [ (fn [] (vim.lsp.buf.range_formatting [] [0 0] [(vim.fn.line "$") 0]))]}}) - +;(lsp.vimls.setup { :on_attach on_attach}) -(when (not lsp.erlangls) - (set lsp-configs.erlangls - { :default_config - { :cmd ["erlang_ls"] - :filetypes ["lua"] - :root_dir (lsp.util.root_pattern "rebar.config") - :settings {}}})) -(lsp.erlangls.setup {}) - - (compe.setup { :enabled true :autocomplete false diff --git a/fnl/plugins/telescope.fnl b/fnl/plugins/telescope.fnl index ad4346c..6d5054c 100644 --- a/fnl/plugins/telescope.fnl +++ b/fnl/plugins/telescope.fnl @@ -13,5 +13,5 @@ {:defaults {:i { "" actions.close}}}) - +(telescope.load_extension "media_files") diff --git a/init.vim b/init.vim index 14677d0..d69dfcc 100644 --- a/init.vim +++ b/init.vim @@ -123,7 +123,7 @@ augroup basics autocmd BufRead,BufNewFile *.ddl setlocal filetype=sql - " Auto-close quickfix list after entry is selected + " Auto-close quickfix list when element autocmd FileType qf nnoremap :cclose augroup END @@ -214,7 +214,6 @@ au Syntax * RainbowParenthesesLoadBraces nnoremap :Telescope find_files -lua require('telescope').load_extension('media_files') "map f (easymotion-bd-f)