nvim: Cleanup config
This commit is contained in:
parent
383ecccd04
commit
e648e4dcbb
3 changed files with 2 additions and 76 deletions
|
@ -1,74 +0,0 @@
|
||||||
(let [mod {}
|
|
||||||
spinner-frames ["⣾" "⣽" "⣻" "⢿" "⡿" "⣟" "⣯" "⣷"]
|
|
||||||
client-notifications {}]
|
|
||||||
;; Progress Notifications
|
|
||||||
;; Based on: https://github.com/rcarriga/nvim-notify/wiki/Usage-Recipes#progress-updates
|
|
||||||
|
|
||||||
(fn get-notification-data [client-id token]
|
|
||||||
(when (= (. client-notifications client-id) nil)
|
|
||||||
(tset client-notifications client-id {}))
|
|
||||||
(when (= (. client-notifications client-id token) nil)
|
|
||||||
(tset client-notifications client-id token {}))
|
|
||||||
(. client-notifications client-id token))
|
|
||||||
|
|
||||||
(fn update-notifcation-spinner [client-id token]
|
|
||||||
(let [notification-data (get-notification-data client-id token)]
|
|
||||||
(when notification-data.spinner
|
|
||||||
(let [new-spinner (% (+ notification-data.spinner 1)
|
|
||||||
(length spinner-frames))]
|
|
||||||
(set notification-data.spinner new-spinner)
|
|
||||||
(set notification-data.notification
|
|
||||||
(vim.notify nil nil
|
|
||||||
{:hide_from_history true
|
|
||||||
:icon (. spinner-frames new-spinner)
|
|
||||||
:replace notification-data.notification}))
|
|
||||||
(vim.defer_fn #(update-notifcation-spinner client-id token))))))
|
|
||||||
|
|
||||||
(fn format-notifcation-title [title client-name]
|
|
||||||
(.. client-name (if (> (length title) 0) (.. ": " title) "")))
|
|
||||||
|
|
||||||
(fn format-notifcation-message [message percentage]
|
|
||||||
(.. (if percentage (.. percentage "%\t") "") (if message message "")))
|
|
||||||
|
|
||||||
(fn handle-progress [err result ctx]
|
|
||||||
(let [client-id ctx.client_id
|
|
||||||
val result.value
|
|
||||||
kind val.kind
|
|
||||||
lsp-client (vim.lsp.get_client_by_id client-id)
|
|
||||||
client-name lsp-client.name
|
|
||||||
notification-data (get-notification-data client-id result.token)]
|
|
||||||
(if (= kind :begin)
|
|
||||||
(let [message (format-notifcation-message val.message val.percentage)]
|
|
||||||
(set notification-data.notification
|
|
||||||
(vim.notify message :info
|
|
||||||
{:title (format-notifcation-title val.title
|
|
||||||
client-name)
|
|
||||||
:icon (. spinner-frames 1)
|
|
||||||
:timeout false
|
|
||||||
:hide_from_history false}))
|
|
||||||
(set notification-data.spinner 1)
|
|
||||||
(update-notifcation-spinner client-id result.token))
|
|
||||||
(and (= kind :report) notification-data)
|
|
||||||
(let [message (format-notifcation-message val.message val.percentage)]
|
|
||||||
(set notification-data.notification
|
|
||||||
(vim.notify message :info
|
|
||||||
{:replace notification-data.notification
|
|
||||||
:hide_from_history false})))
|
|
||||||
(and (= kind :end) notification-data)
|
|
||||||
(let [message (if val.message
|
|
||||||
(format-notifcation-message val.message)
|
|
||||||
:Complete)]
|
|
||||||
(set notification-data.notification
|
|
||||||
(vim.notify message :info
|
|
||||||
{:icon ""
|
|
||||||
:replace notification-data.notification
|
|
||||||
:timeout 3000}))
|
|
||||||
(set notification-data.spinner nil)))))
|
|
||||||
|
|
||||||
;; Public Interface
|
|
||||||
|
|
||||||
(fn mod.register-progress-handler []
|
|
||||||
(tset vim.lsp.handlers :$/progress handle-progress))
|
|
||||||
|
|
||||||
mod)
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
(let [lsp (require :lspconfig)
|
(let [lsp (require :lspconfig)
|
||||||
cmp (require :cmp_nvim_lsp)
|
cmp (require :cmp_nvim_lsp)
|
||||||
navic (require :nvim-navic)
|
navic (require :nvim-navic)
|
||||||
nifoc-lsp (require :nifoc.lsp)
|
|
||||||
diagnostic (require :nifoc.diagnostic)
|
diagnostic (require :nifoc.diagnostic)
|
||||||
formatting (require :nifoc.formatting)]
|
formatting (require :nifoc.formatting)]
|
||||||
(fn custom-attach [client bufnr]
|
(fn custom-attach [client bufnr]
|
||||||
|
@ -19,7 +18,6 @@
|
||||||
(vim.lsp.with vim.lsp.handlers.hover {:border :rounded}))
|
(vim.lsp.with vim.lsp.handlers.hover {:border :rounded}))
|
||||||
(tset vim.lsp.handlers :textDocument/signatureHelp
|
(tset vim.lsp.handlers :textDocument/signatureHelp
|
||||||
(vim.lsp.with vim.lsp.handlers.signature_help {:border :rounded}))
|
(vim.lsp.with vim.lsp.handlers.signature_help {:border :rounded}))
|
||||||
(nifoc-lsp.register-progress-handler)
|
|
||||||
;; Servers
|
;; Servers
|
||||||
(let [default-capabilities (vim.lsp.protocol.make_client_capabilities)
|
(let [default-capabilities (vim.lsp.protocol.make_client_capabilities)
|
||||||
capabilities (cmp.update_capabilities default-capabilities)
|
capabilities (cmp.update_capabilities default-capabilities)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
(let [osc52 (require :osc52)
|
(let [osc52 (require :osc52)
|
||||||
uname (vim.loop.os_uname)
|
uname (vim.loop.os_uname)
|
||||||
clip-name :nifocClipboard]
|
clip-name :nifocClipboard]
|
||||||
|
(osc52.setup {:silent true})
|
||||||
|
|
||||||
(fn copy [lines _]
|
(fn copy [lines _]
|
||||||
(-> lines
|
(-> lines
|
||||||
(table.concat "\n")
|
(table.concat "\n")
|
||||||
|
|
Loading…
Reference in a new issue