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)