mirror of
https://github.com/stevenproctor/dotfiles.git
synced 2026-01-28 09:59:54 -06:00
nvim - more refactor away from aniseed to pure fennel
This commit is contained in:
@@ -1,34 +0,0 @@
|
|||||||
(module dotfiles.plugin.compe {autoload {nvim aniseed.nvim}})
|
|
||||||
|
|
||||||
(set vim.o.completeopt "menuone,noselect")
|
|
||||||
|
|
||||||
(let [compe (require :compe)]
|
|
||||||
(when compe
|
|
||||||
(compe.setup {:enabled true
|
|
||||||
:autocomplete true
|
|
||||||
:debug false
|
|
||||||
:min_length 1
|
|
||||||
:preselect :enable
|
|
||||||
:throttle_time 80
|
|
||||||
:source_timeout 200
|
|
||||||
:incomplete_delay 400
|
|
||||||
:max_abbr_width 100
|
|
||||||
:max_kind_width 100
|
|
||||||
:max_menu_width 100
|
|
||||||
:documentation true
|
|
||||||
:source {:path true
|
|
||||||
:buffer true
|
|
||||||
:calc true
|
|
||||||
:emoji true
|
|
||||||
:nvim_lsp true
|
|
||||||
:nvim_lua true
|
|
||||||
:conjure true
|
|
||||||
:orgmode true
|
|
||||||
:vsnip true
|
|
||||||
:vim_dadbod_completion true}})))
|
|
||||||
|
|
||||||
(nvim.ex.inoremap "<silent><expr> <C-Space> compe#complete()")
|
|
||||||
(nvim.ex.inoremap "<silent><expr> <CR> compe#confirm('<CR>')")
|
|
||||||
(nvim.ex.inoremap "<silent><expr> <C-e> compe#close('<C-e>')")
|
|
||||||
(nvim.ex.inoremap "<silent><expr> <C-f> compe#scroll({ 'delta': +4 })")
|
|
||||||
(nvim.ex.inoremap "<silent><expr> <C-d> compe#scroll({ 'delta': -4 })")
|
|
||||||
@@ -4,14 +4,13 @@
|
|||||||
nvim aniseed.nvim
|
nvim aniseed.nvim
|
||||||
lsp vim.lsp
|
lsp vim.lsp
|
||||||
lspconfig lspconfig
|
lspconfig lspconfig
|
||||||
mason dotfiles.plugin.mason
|
|
||||||
cmp_nvim_lsp cmp_nvim_lsp}})
|
cmp_nvim_lsp cmp_nvim_lsp}})
|
||||||
|
|
||||||
(defn bufmap [mode from to] (u.noremap mode from to {:local? true}))
|
(fn bufmap [mode from to] (u.noremap mode from to {:local? true}))
|
||||||
|
|
||||||
(defn nbufmap [from to] (bufmap :n from to))
|
(fn nbufmap [from to] (bufmap :n from to))
|
||||||
|
|
||||||
(defn xbufmap [from to] (bufmap :x from to))
|
(fn xbufmap [from to] (bufmap :x from to))
|
||||||
|
|
||||||
(vim.diagnostic.config {:signs {:text {vim.diagnostic.severity.ERROR "☢️"
|
(vim.diagnostic.config {:signs {:text {vim.diagnostic.severity.ERROR "☢️"
|
||||||
vim.diagnostic.severity.WARN "⚠️"
|
vim.diagnostic.severity.WARN "⚠️"
|
||||||
@@ -21,69 +20,69 @@
|
|||||||
;; :numhl {vim.diagnostic.severity.WARN :WarningMsg}
|
;; :numhl {vim.diagnostic.severity.WARN :WarningMsg}
|
||||||
}})
|
}})
|
||||||
|
|
||||||
(def core-nmappings
|
(local core-nmappings
|
||||||
{:gd "lua vim.lsp.buf.definition()"
|
{:gd "lua vim.lsp.buf.definition()"
|
||||||
:gD "lua vim.lsp.buf.declaration()"
|
:gD "lua vim.lsp.buf.declaration()"
|
||||||
:gi "lua vim.lsp.buf.implementation()"
|
:gi "lua vim.lsp.buf.implementation()"
|
||||||
:gr "lua vim.lsp.buf.references()"
|
:gr "lua vim.lsp.buf.references()"
|
||||||
:K "lua vim.lsp.buf.hover()"
|
:K "lua vim.lsp.buf.hover()"
|
||||||
"[g" "lua vim.diagnostic.goto_prev()"
|
"[g" "lua vim.diagnostic.goto_prev()"
|
||||||
"]g" "lua vim.diagnostic.goto_next()"
|
"]g" "lua vim.diagnostic.goto_next()"
|
||||||
;:<c-k> "lua vim.lsp.buf.signature_help()"
|
;:<c-k> "lua vim.lsp.buf.signature_help()"
|
||||||
:<leader>ca "lua vim.lsp.buf.code_action()"
|
:<leader>ca "lua vim.lsp.buf.code_action()"
|
||||||
:<leader>cl "lua vim.lsp.codelens.run()"
|
:<leader>cl "lua vim.lsp.codelens.run()"
|
||||||
:<leader>ic "lua vim.lsp.buf.incoming_calls()"
|
:<leader>ic "lua vim.lsp.buf.incoming_calls()"
|
||||||
;; TODO: think of new mapping; conficts with org mode
|
;; TODO: think of new mapping; conficts with org mode
|
||||||
;; :<leader>oc "lua vim.lsp.buf.outgoing_calls()"
|
;; :<leader>oc "lua vim.lsp.buf.outgoing_calls()"
|
||||||
:<leader>sld "lua vim.diagnostic.open_float(nil, {source = 'always'})"
|
:<leader>sld "lua vim.diagnostic.open_float(nil, {source = 'always'})"
|
||||||
:<leader>rn "lua vim.lsp.buf.rename()"
|
:<leader>rn "lua vim.lsp.buf.rename()"
|
||||||
:<leader>fa "lua vim.lsp.buf.format()"})
|
:<leader>fa "lua vim.lsp.buf.format()"})
|
||||||
|
|
||||||
(def client-nmappings
|
(local client-nmappings
|
||||||
{:clojure_lsp {:<leader>cn "call LspExecuteCommand('clean-ns')"
|
{:clojure_lsp {:<leader>cn "call LspExecuteCommand('clean-ns')"
|
||||||
:<leader>ref "call LspExecuteCommand('extract-function', input('Function name: '))"
|
:<leader>ref "call LspExecuteCommand('extract-function', input('Function name: '))"
|
||||||
:<leader>id "call LspExecuteCommand('inline-symbol')"
|
:<leader>id "call LspExecuteCommand('inline-symbol')"
|
||||||
:<leader>il "call LspExecuteCommand('introduce-let', input('Binding name: '))"
|
:<leader>il "call LspExecuteCommand('introduce-let', input('Binding name: '))"
|
||||||
:<leader>m2l "call LspExecuteCommand('move-to-let', input('Binding name: '))"}})
|
:<leader>m2l "call LspExecuteCommand('move-to-let', input('Binding name: '))"}})
|
||||||
|
|
||||||
(def client-command-lnmappings
|
(local client-command-lnmappings
|
||||||
{:clojure_lsp {:ai [:add-import-to-namespace ["input('Namespace name: ')"]]
|
{:clojure_lsp {:ai [:add-import-to-namespace
|
||||||
:am [:add-missing-libspec []]
|
["input('Namespace name: ')"]]
|
||||||
:as [:add-require-suggestion
|
:am [:add-missing-libspec []]
|
||||||
["input('Namespace name: ')"
|
:as [:add-require-suggestion
|
||||||
"input('Namespace as: ')"
|
["input('Namespace name: ')"
|
||||||
"input('Namespace name: ')"]]
|
"input('Namespace as: ')"
|
||||||
:cc [:cycle-coll []]
|
"input('Namespace name: ')"]]
|
||||||
:cn [:clean-ns []]
|
:cc [:cycle-coll []]
|
||||||
:cp [:cycle-privacy []]
|
:cn [:clean-ns []]
|
||||||
:ct [:create-test []]
|
:cp [:cycle-privacy []]
|
||||||
:df [:drag-forward []]
|
:ct [:create-test []]
|
||||||
:db [:drag-backward []]
|
:df [:drag-forward []]
|
||||||
:df [:drag-forward []]
|
:db [:drag-backward []]
|
||||||
:dk [:destructure-keys []]
|
:df [:drag-forward []]
|
||||||
:ed [:extract-to-def ["input('Definition name: ')"]]
|
:dk [:destructure-keys []]
|
||||||
:ef [:extract-function ["input('Function name: ')"]]
|
:ed [:extract-to-def ["input('Definition name: ')"]]
|
||||||
:el [:expand-let []]
|
:ef [:extract-function ["input('Function name: ')"]]
|
||||||
:fe [:create-function []]
|
:el [:expand-let []]
|
||||||
:il [:introduce-let ["input('Binding name: ')"]]
|
:fe [:create-function []]
|
||||||
:is [:inline-symbol []]
|
:il [:introduce-let ["input('Binding name: ')"]]
|
||||||
:ma [:resolve-macro-as []]
|
:is [:inline-symbol []]
|
||||||
:mf [:move-form ["input('File name: ')"]]
|
:ma [:resolve-macro-as []]
|
||||||
:ml [:move-to-let ["input('Binding name: ')"]]
|
:mf [:move-form ["input('File name: ')"]]
|
||||||
:pf [:promote-fn ["input('Function name: ')"]]
|
:ml [:move-to-let ["input('Binding name: ')"]]
|
||||||
:sc [:change-collection ["input('Collection type: ')"]]
|
:pf [:promote-fn ["input('Function name: ')"]]
|
||||||
:sm [:sort-map []]
|
:sc [:change-collection ["input('Collection type: ')"]]
|
||||||
:tf [:thread-first-all []]
|
:sm [:sort-map []]
|
||||||
:tF [:thread-first []]
|
:tf [:thread-first-all []]
|
||||||
:tl [:thread-last-all []]
|
:tF [:thread-first []]
|
||||||
:tL [:thread-last []]
|
:tl [:thread-last-all []]
|
||||||
:ua [:unwind-all []]
|
:tL [:thread-last []]
|
||||||
:uw [:unwind-thread []]}})
|
:ua [:unwind-all []]
|
||||||
|
:uw [:unwind-thread []]}})
|
||||||
|
|
||||||
(def server-specific-opts {})
|
(local server-specific-opts {})
|
||||||
|
|
||||||
(defn bind-client-mappings
|
(fn bind-client-mappings [client]
|
||||||
[client]
|
|
||||||
(let [client-name (a.get client :name)
|
(let [client-name (a.get client :name)
|
||||||
mappings (a.get client-nmappings client-name)
|
mappings (a.get client-nmappings client-name)
|
||||||
command-lnmappings (a.get client-command-lnmappings client-name)]
|
command-lnmappings (a.get client-command-lnmappings client-name)]
|
||||||
@@ -99,8 +98,7 @@
|
|||||||
cmd (.. "call LspExecuteCommand('" lsp-cmd "'" opts-str ")")]
|
cmd (.. "call LspExecuteCommand('" lsp-cmd "'" opts-str ")")]
|
||||||
(nbufmap mapping cmd))))))
|
(nbufmap mapping cmd))))))
|
||||||
|
|
||||||
(defn on_attach
|
(fn on_attach [client bufnr]
|
||||||
[client bufnr]
|
|
||||||
(each [mapping cmd (pairs core-nmappings)]
|
(each [mapping cmd (pairs core-nmappings)]
|
||||||
(nbufmap mapping cmd)) ; x mode mappings
|
(nbufmap mapping cmd)) ; x mode mappings
|
||||||
(xbufmap :<leader>fa "lua vim.lsp.buf.format()") ; -- buf_set_keymap('n', 'gs', '<Cmd>lua vim.lsp.buf.document_symbol()<CR>', opts)
|
(xbufmap :<leader>fa "lua vim.lsp.buf.format()") ; -- buf_set_keymap('n', 'gs', '<Cmd>lua vim.lsp.buf.document_symbol()<CR>', opts)
|
||||||
@@ -119,19 +117,17 @@
|
|||||||
; client autocmds ; -- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf_request_sync(vim.api.nvim_get_current_buf(), 'workspace/executeCommand', {command = 'clean-ns', arguments = {vim.uri_from_bufnr(1), vim.api.nvim_win_get_cursor(0)[1], vim.api.nvim_win_get_cursor(0)[2]}, title = 'Clean Namespace'})]]
|
; client autocmds ; -- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf_request_sync(vim.api.nvim_get_current_buf(), 'workspace/executeCommand', {command = 'clean-ns', arguments = {vim.uri_from_bufnr(1), vim.api.nvim_win_get_cursor(0)[1], vim.api.nvim_win_get_cursor(0)[2]}, title = 'Clean Namespace'})]]
|
||||||
(print "LSP Client Attached."))
|
(print "LSP Client Attached."))
|
||||||
|
|
||||||
(def base-server-opts
|
(local base-server-opts
|
||||||
(let [capabilities (cmp_nvim_lsp.default_capabilities (lsp.protocol.make_client_capabilities))]
|
(let [capabilities (cmp_nvim_lsp.default_capabilities (lsp.protocol.make_client_capabilities))]
|
||||||
{: on_attach : capabilities :flags {:debounce_text_changes 150}}))
|
{: on_attach : capabilities :flags {:debounce_text_changes 150}}))
|
||||||
|
|
||||||
(defn default-server-handler
|
(fn default-server-handler [server-name]
|
||||||
[server-name]
|
|
||||||
(let [specific-opts (a.get server-specific-opts server-name {})
|
(let [specific-opts (a.get server-specific-opts server-name {})
|
||||||
server (a.get lspconfig server-name)
|
server (a.get lspconfig server-name)
|
||||||
server-opts (a.merge base-server-opts server-opts)]
|
server-opts (a.merge base-server-opts server-opts)]
|
||||||
(server.setup server-opts)))
|
(server.setup server-opts)))
|
||||||
|
|
||||||
(defn lsp-execute-command
|
(fn lsp-execute-command [cmd ...]
|
||||||
[cmd ...]
|
|
||||||
(let [buf-uri (vim.uri_from_bufnr 0)
|
(let [buf-uri (vim.uri_from_bufnr 0)
|
||||||
cursor (vim.api.nvim_win_get_cursor 0)
|
cursor (vim.api.nvim_win_get_cursor 0)
|
||||||
r (- (a.first cursor) 1)
|
r (- (a.first cursor) 1)
|
||||||
@@ -140,11 +136,6 @@
|
|||||||
args (a.concat opts [...])]
|
args (a.concat opts [...])]
|
||||||
(vim.lsp.buf.execute_command {:command cmd :arguments args})))
|
(vim.lsp.buf.execute_command {:command cmd :arguments args})))
|
||||||
|
|
||||||
(mason.setup)
|
|
||||||
|
|
||||||
(when-let [mason-lspconfig (require :mason-lspconfig)] (mason-lspconfig.setup)
|
|
||||||
(mason-lspconfig.setup_handlers {1 default-server-handler}))
|
|
||||||
|
|
||||||
(u.nnoremap :<leader>li :LspInfo)
|
(u.nnoremap :<leader>li :LspInfo)
|
||||||
|
|
||||||
(vim.api.nvim_create_user_command :LspExecuteCommand lsp-execute-command {})
|
(vim.api.nvim_create_user_command :LspExecuteCommand lsp-execute-command {})
|
||||||
|
|||||||
@@ -9,3 +9,8 @@
|
|||||||
(mason-lspconf.setup_handlers {1 lspconfig.default-server-handler})))))
|
(mason-lspconf.setup_handlers {1 lspconfig.default-server-handler})))))
|
||||||
|
|
||||||
(setup)
|
(setup)
|
||||||
|
;; (mason.setup)
|
||||||
|
;;
|
||||||
|
;; (when-let [mason-lspconfig (require :mason-lspconfig)]
|
||||||
|
;; (mason-lspconfig.setup)
|
||||||
|
;; (mason-lspconfig.setup_handlers {1 default-server-handler}))
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
(module dotfiles.plugin.telescope
|
(local util (require :dotfiles.util))
|
||||||
{autoload {nvim aniseed.nvim
|
(local telescope (require :telescope))
|
||||||
util dotfiles.util
|
|
||||||
telescope telescope
|
|
||||||
project-nvim project_nvim}})
|
|
||||||
|
|
||||||
(local vimgrep_arguments [:ag
|
(local vimgrep_arguments [:ag
|
||||||
:--nocolor
|
:--nocolor
|
||||||
|
|||||||
Reference in New Issue
Block a user