Some cleanup of nvim

This commit is contained in:
elkowar 2022-02-01 11:44:34 +01:00
parent cc672106a3
commit fe4a5cf0b1
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F
11 changed files with 87 additions and 416 deletions

View file

@ -37,15 +37,6 @@
;:syntax "markdown"
;:ext "md"}])}
:github/copilot.vim {:opt true :cmd ["Copilot"]}
:lervag/vimtex {:opt false
:setup #(require :dots.plugins.vimtex)}
:brymer-meneses/grammar-guard.nvim {:opt false
:requires ["williamboman/nvim-lsp-installer"
"neovim/nvim-lspconfig"]}
; sorted from here!
:Olical/aniseed {:branch "develop"}
:lewis6991/impatient.nvim {}
@ -100,10 +91,7 @@
:rcarriga/nvim-dap-ui {:opt false
:config #((. (require :dapui) :setup))
:requires [:mfussenegger/nvim-dap]}
:mfussenegger/nvim-dap {:opt false :config #(require "dots.plugins.nvim-dap")}
:mfussenegger/nvim-dap {:opt false}
:nvim-telescope/telescope-dap.nvim {:requires [:mfussenegger/nvim-dap
:nvim-telescope/telescope.nvim]}
@ -176,6 +164,8 @@
; >>>
; code-related ----------------------------------------- <<<
:github/copilot.vim {:opt true :cmd ["Copilot"]}
:tpope/vim-sleuth {}
:editorconfig/editorconfig-vim {}
:pechorin/any-jump.vim {}
@ -184,7 +174,7 @@
:Olical/conjure {:ft ["fennel"]}
:eraserhd/parinfer-rust {:run "cargo build --release"}
:lervag/vimtex {:opt false :setup #(require :dots.plugins.vimtex)}
:kmonad/kmonad-vim {}
:elkowar/yuck.vim {:ft ["yuck"]}
:cespare/vim-toml {:ft ["toml"]}

View file

@ -1,47 +0,0 @@
(module dots.plugins.compe
{autoload {utils dots.utils
compe compe}})
(utils.keymap :i :<C-Space> "compe#complete()" {:expr true})
(utils.keymap :i :kj "compe#close('<esc>')" {:expr true})
;(utils.keymap :i :<esc> "compe#close('<esc>')" {:expr true})
(defn result-formatter [items]
(var max-width 0)
(each [_ item (ipairs items)]
(set item.abbr (-> item.abbr
(string.gsub "~$" "")
(string.gsub " %(.*%)$" "")))
(set max-width (math.max max-width (vim.fn.strwidth item.abbr))))
(each [_ item (ipairs items)]
(let [padding (string.rep " " (- max-width (vim.fn.strwidth item.abbr)))
details (?. item :user_data :compe :completion_item :detail)]
(when details
(set item.abbr (.. item.abbr padding " " details)))))
items)
(compe.setup
{:enabled true
:autocomplete false
: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
:formatting_functions {:nvim_lsp {:results result-formatter}}
:source {:path true
:buffer true
:calc true
:nvim_lsp true
:nvim_lua true
:emoji false
:vsnip false
:conjure true}})

View file

@ -1,11 +0,0 @@
(module dots.plugins.coq-nvim
{autoload {utils dots.utils
coq coq}})
(set vim.g.coq_settings {:limits.completion_auto_timeout 1
:clients.lsp.weight_adjust 2
:clients.tree_sitter.enabled false
:display.icons.mode "short"})
(vim.cmd "autocmd! InsertEnter * COQnow --shut-up")

View file

@ -1,7 +0,0 @@
(module dots.plugins.detect-indent)
;(vim.cmd "autocmd! BufReadPost * :DetectIndent")
(set vim.g.detectindent_preferred_expandtab 1)
(set vim.g.detectindent_preferred_indent 2)

View file

@ -73,7 +73,7 @@
(defn coordinates []
(let [[line col] (vim.api.nvim_win_get_cursor 0)]
(.. " #" line " ")))
(.. " " line " ")))
; Fills the bar with an horizontal line
@ -86,7 +86,7 @@
(tset components.active 1
[{:provider vim-mode :hl #(vim-mode-hl false)}
{:provider get-current-filepath :left_sep " "}
{:provider get-current-filepath :left_sep " " :hl {:fg colors.light4}}
{:provider git-status-provider :left_sep " " :hl #(vim-mode-hl true)}])
(tset components.active 2

View file

@ -1,108 +0,0 @@
(module dots.plugins.galaxyline
{autoload {a aniseed.core
str aniseed.string
nvim aniseed.nvim
utils dots.utils
colors dots.colors
galaxyline galaxyline
gl-condition galaxyline.condition
gl-fileinfo galaxyline.provider_fileinfo
gl-diagnostic galaxyline.provider_diagnostic
gl-vcs galaxyline.provider_vcs}
require-macros [macros]})
(def- bar-bg-col colors.dark1)
(local modes
{:n {:text "NORMAL" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:i {:text "INSERT" :colors {:bg colors.neutral_yellow :fg colors.dark0}}
:c {:text "CMMAND" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:ce {:text "NORMEX" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:cv {:text "EX" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:ic {:text "INSCOMP" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:no {:text "OP-PENDING" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:r {:text "HIT-ENTER" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:r? {:text "CONFIRM" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:R {:text "REPLACE" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:Rv {:text "VIRTUAL" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:s {:text "SELECT" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:S {:text "SELECT" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:t {:text "TERM" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
:v {:text "VISUAL" :colors {:bg colors.neutral_blue :fg colors.dark0}}
:V {:text "VISUAL LINE" :colors {:bg colors.neutral_blue :fg colors.dark0}}
"" {:text "VISUAL BLOCK" :colors {:bg colors.neutral_blue :fg colors.dark0}}})
(fn get-current-filename []
(nvim.fn.expand "%:t"))
(fn get-current-filepath []
(let [file (utils.shorten-path (vim.fn.bufname) 5 50)]
(if (a.empty? file) ""
nvim.bo.readonly (.. "RO " file)
(and nvim.bo.modifiable nvim.bo.modified) (.. file " ")
file)))
(set galaxyline.short_line_list ["dbui" "diff" "peekaboo" "undotree" "vista" "vista_markdown"])
(fn make-lsp-diagnostic-provider [kind]
(fn []
(let [n (vim.lsp.diagnostic.get_count 0 kind)]
(if (= n 0) "" (.. " " n " ")))))
(set galaxyline.section.left
[{:ViMode {:provider
#(let [vim-mode (nvim.fn.mode)
modedata (or (. modes vim-mode)
{:text vim-mode
:colors {:bg colors.neutral_orange :fg colors.dark0}})]
(utils.highlight "GalaxyViMode" modedata.colors)
(.. " " modedata.text " "))}}
{:FileName {:provider get-current-filepath
:highlight [colors.light4 bar-bg-col]}}
{:Space {:provider #""
:highlight [colors.light0 bar-bg-col]}}])
(set galaxyline.section.right
[{:GitBranch {:highlight [colors.light4 bar-bg-col]
:provider
#(let [branch (gl-vcs.get_git_branch)]
(if (= "master" branch) "" branch))}}
{:FileType {:provider #nvim.bo.filetype
:highlight [colors.neutral_aqua bar-bg-col]}}
{:DiagnosticInfo {:provider (make-lsp-diagnostic-provider "Info")
:highlight [colors.dark1 colors.neutral_blue]}}
{:DiagnosticWarn {:provider (make-lsp-diagnostic-provider "Warning")
:highlight [colors.dark1 colors.neutral_yellow]
:separator ""}}
{:DiagnosticError {:provider (make-lsp-diagnostic-provider "Error")
:highlight [colors.dark1 colors.bright_red]
:separator ""}}
{:LineInfo {:provider #(.. " " (gl-fileinfo.line_column) " ")
:highlight "GalaxyViMode"
:separator ""}}])
(do
(fn add-segment-defaults [data]
(a.merge {:highlight [colors.light0 bar-bg-col]
:separator " "
:separator_highlight "StatusLine"}
data))
(fn map-gl-section [f section]
(icollect [_ elem (ipairs section)]
(collect [k v (pairs elem)]
(values k (f v)))))
(set galaxyline.section.left (map-gl-section add-segment-defaults galaxyline.section.left))
(set galaxyline.section.right (map-gl-section add-segment-defaults galaxyline.section.right)))

View file

@ -1,166 +0,0 @@
(module dots.plugins.lililine
{autoload {a aniseed.core
str aniseed.string
nvim aniseed.nvim
utils dots.utils
colors dots.colors
line lililine}
require-macros [macros]})
(fn get-current-filename []
(nvim.fn.expand "%:t"))
(fn get-current-filepath []
(let [file (utils.shorten-path (vim.fn.bufname) 5 50)]
(if (a.empty? file) ""
nvim.bo.readonly (.. "RO " file)
(and nvim.bo.modifiable nvim.bo.modified) (.. file " ")
file)))
(fn make-lsp-diagnostic-provider [kind]
(fn []
(let [n (vim.lsp.diagnostic.get_count 0 kind)]
(if (= n 0) "" (.. " " n " ")))))
(def bar-bg colors.dark0_soft)
(def modes
{:n {:text "NORMAL" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:i {:text "INSERT" :color {:bg colors.neutral_yellow :fg colors.dark0}}
:c {:text "CMMAND" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:ce {:text "NORMEX" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:cv {:text "EX" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:ic {:text "INSCOMP" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:no {:text "OP-PENDING" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:r {:text "HIT-ENTER" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:r? {:text "CONFIRM" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:R {:text "REPLACE" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:Rv {:text "VIRTUAL" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:s {:text "SELECT" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:S {:text "SELECT" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:t {:text "TERM" :color {:bg colors.neutral_aqua :fg colors.dark0}}
:v {:text "VISUAL" :color {:bg colors.neutral_blue :fg colors.dark0}}
:V {:text "VISUAL LINE" :color {:bg colors.neutral_blue :fg colors.dark0}}
"" {:text "VISUAL BLOCK" :color {:bg colors.neutral_blue :fg colors.dark0}}})
(utils.highlight :StatusLine {:bg bar-bg :fg colors.light4})
(utils.highlight :StatusLineFilePath {:bg bar-bg :fg colors.light4})
(utils.highlight :StatusLineLspInfo {:bg colors.neutral_blue :fg bar-bg})
(utils.highlight :StatusLineLspWarn {:bg colors.neutal_yellow :fg bar-bg})
(utils.highlight :StatusLineLspError {:bg colors.bright_red :fg bar-bg})
(def space {:provider #" " :highlight :StatusLineBase})
(set line.lines.status
[[; Mode
{:provider #(let [data (or (. modes (vim.fn.mode))
{:text (vim.fn.mode)
:color {:bg colors.neutral_orange :fg colors.dark0}})]
{:text (.. " " data.text " ") :color data.color})
:highlight :StatusLineMode}
space
; Filepath
{:provider get-current-filepath
:highlight :StatusLineFilePath}]
[]
[; Filetype
{:provider #vim.bo.filetype :highlight :StatusLine}
; Diagnostics
{:provider (make-lsp-diagnostic-provider "Info")
:highlight :StatusLineLspInfo}
{:provider (make-lsp-diagnostic-provider "Warning")
:highlight :StatusLineLspWarn}
{:provider (make-lsp-diagnostic-provider "Error")
:highlight :StatusLineLspError}
; Line info
{:provider #(let [[line col] (vim.api.nvim_win_get_cursor 0)]
(.. " " line ":" col " "))
:highlight :StatusLineMode}]])
;{:LineInfo {:provider #(.. " " (gl-fileinfo.line_column) " ")
;:highlight "GalaxyViMode"
;:separator ""}}])
; TODO
;Git-branch
;{:provider #(let [branch (vim.fn.system "git rev-parse --abbrev-ref HEAD")]
;(if (= "master" branch) "" branch))
;:highlight :StatusLine}]])
;(set galaxyline.section.left
;[{:ViMode {:provider
;#(let [vim-mode (nvim.fn.mode)
;modedata (or (. modes vim-mode)
;{:text vim-mode
;:colors {:bg colors.neutral_orange :fg colors.dark0}})]
;(utils.highlight "GalaxyViMode" modedata.colors)
;(.. " " modedata.text " "))}}
;{:FileName {:provider get-current-filepath
;:highlight [colors.light4 bar-bg-col]}}
;{:Space {:provider #""
;:highlight [colors.light0 bar-bg-col]}}])
;(set galaxyline.section.right
;[{:GitBranch {:highlight [colors.light4 bar-bg-col]
;:provider
;#(let [branch (gl-vcs.get_git_branch)]
;(if (= "master" branch) "" branch))}}
;{:FileType {:provider #nvim.bo.filetype
;:highlight [colors.neutral_aqua bar-bg-col]}}
;{:DiagnosticInfo {:provider (make-lsp-diagnostic-provider "Info")
;:highlight [colors.dark1 colors.neutral_blue]}}
;{:DiagnosticWarn {:provider (make-lsp-diagnostic-provider "Warning")
;:highlight [colors.dark1 colors.neutral_yellow]
;:separator ""}}
;{:DiagnosticError {:provider (make-lsp-diagnostic-provider "Error")
;:highlight [colors.dark1 colors.bright_red]
;:separator ""}}
;{:LineInfo {:provider #(.. " " (gl-fileinfo.line_column) " ")
;:highlight "GalaxyViMode"
;:separator ""}}])
;(do
;(fn add-segment-defaults [data]
;(a.merge {:highlight [colors.light0 bar-bg-col]
;:separator " "
;:separator_highlight "StatusLine"}
;data))
;(fn map-gl-section [f section]
;(icollect [_ elem (ipairs section)]
;(collect [k v (pairs elem)]
;(values k (f v)))))
;(set galaxyline.section.left (map-gl-section add-segment-defaults galaxyline.section.left))
;(set galaxyline.section.right (map-gl-section add-segment-defaults galaxyline.section.right)))

View file

@ -15,7 +15,8 @@
(vim.lsp.with vim.lsp.diagnostic.on_publish_diagnostics
{:update_in_insert false
:virtual_text {:prefix "◆"}
:signs false}))
:signs false
:severity_sort true}))
@ -86,18 +87,10 @@
;(init-lsp :powershell_es {})
(init-lsp :clangd)
;(init-lsp :ccls)
;((. (require "grammar-guard") :init))
;(init-lsp :grammar_guard {:cmd "~/.local/share/nvim/lsp_servers/ltex/ltex-ls/bin/ltex-ls"
;:settings {:ltex {:enabled ["latex" "tex"]
;:additionalRules {:motherTongue "de-DE"}}}})
(init-lsp :cssls {:filestypes ["css" "scss" "less" "stylus"]
:root_dir (lsp.util.root_pattern ["package.json" ".git"])
:settings {:css {:validate true}

View file

@ -1,27 +0,0 @@
(module dots.plugins.nvim-dap
{autoload {a aniseed.core
utils dots.utils
dap dap}})
(set dap.adapters.cpp
{:type "executable"
:attach {:pidProperty "pid" :pidSelect "ask"}
:command "lldb-vscode"
:env {:LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY "yes"}
:name "lldb"})
(set dap.adapters.node2
{:type "executable"
:command "node"
:args ["/home/leon/tmp/vscode-node-debug2/out/src/nodeDebug.js"]})
(set dap.configurations.javascript
[{:name "javascript"
:type "node2"
:request "launch"
:program "${workspaceFolder}/${file}"
:cwd (vim.fn.getcwd)
:sourceMaps true
:protocol "inspector"
:console "integratedTerminal"}])

View file

@ -1,7 +1,59 @@
(module dots.plugins.telescope
{autoload {utils dots.utils
telescope telescope
actions telescope.actions}})
actions telescope.actions
colors dots.colors}})
(def prompt "blacker")
(if
(= prompt "bright")
(let [promptbg "#689d6a"]
(utils.highlight-add :TelescopePromptBorder {:bg promptbg :fg promptbg})
(utils.highlight-add :TelescopePromptNormal {:bg promptbg :fg colors.dark0})
(utils.highlight-add :TelescopePromptTitle {:bg promptbg :fg colors.dark1}))
(= prompt "dark")
(let [promptbg "#252525"]
(utils.highlight-add :TelescopePromptBorder {:bg promptbg :fg promptbg})
(utils.highlight-add :TelescopePromptNormal {:bg promptbg :fg colors.light2})
(utils.highlight-add :TelescopePromptPrefix {:bg promptbg :fg colors.neutral_aqua})
(utils.highlight-add :TelescopePromptTitle {:bg colors.neutral_blue :fg colors.dark1}))
(= prompt "black")
(let [promptbg "#212526"]
(utils.highlight-add :TelescopePromptBorder {:bg promptbg :fg promptbg})
(utils.highlight-add :TelescopePromptNormal {:bg promptbg :fg colors.light2})
(utils.highlight-add :TelescopePromptPrefix {:bg promptbg :fg colors.neutral_aqua})
(utils.highlight-add :TelescopePromptTitle {:bg colors.neutral_green :fg colors.dark1}))
(= prompt "blacker")
(let [promptbg "#1f2324"]
(utils.highlight-add :TelescopePromptBorder {:bg promptbg :fg promptbg})
(utils.highlight-add :TelescopePromptNormal {:bg promptbg :fg colors.light2})
(utils.highlight-add :TelescopePromptPrefix {:bg promptbg :fg colors.neutral_aqua})
(utils.highlight-add :TelescopePromptTitle {:bg colors.neutral_blue :fg colors.dark1})))
(def side "darker")
(if
(= side "brighter")
(let [previewbg "#1f2324"]
(utils.highlight-add :TelescopePreviewNormal {:bg previewbg})
(utils.highlight-add :TelescopePreviewBorder {:bg previewbg :fg previewbg}))
(= side "darker")
(let [previewbg "#1a1e1f"]
(utils.highlight-add :TelescopePreviewNormal {:bg previewbg})
(utils.highlight-add :TelescopePreviewBorder {:bg previewbg :fg previewbg})))
(utils.highlight-add :TelescopeBorder {:bg colors.dark0_hard :fg colors.dark0_hard})
(utils.highlight-add :TelescopeNormal {:bg colors.dark0_hard})
(utils.highlight-add :TelescopePreviewTitle {:bg colors.neutral_green :fg colors.dark1})
(utils.highlight-add :TelescopeResultsTitle {:bg colors.neutral_aqua :fg colors.dark1})
(utils.highlight-add :TelescopeSelection {:bg colors.neutral_aqua :fg colors.dark1})
(telescope.setup
{:defaults {:mappings {:i {:<esc> actions.close}}

View file

@ -1,4 +1,3 @@
(module init
{autoload {utils dots.utils
nvim aniseed.nvim
@ -22,11 +21,9 @@
(make-errors-epic (require "dots.plugins.lsp"))
(make-errors-epic (require "dots.keybinds"))
;(set vim.opt.runtimepath (.. vim.o.runtimepath ",/home/leon/coding/projects/kbd-vim"))
; TODO
;(make-errors-epic (require "smart-compe-conjure"))
; add to runtimepath
(let [added-paths []]
(set vim.opt.runtimepath (.. vim.o.runtimepath (str.join "," added-paths))))
; Basic setup --------------------------------------- foldstart
@ -112,17 +109,26 @@
[:LspDiagnosticsSignError :LspDiagnosticsSignWarning :LspDiagnosticsSignInformation :LspDiagnosticsSignHint]
{:bg "NONE"})
(utils.highlight-add :LspDiagnosticsDefaultError {:bg "#342828"})
(utils.highlight-add :LspDiagnosticsDefaultWarning {:bg "#473027"})
(utils.highlight-add :LspDiagnosticsDefaultWarning {:bg "#3b2c28"})
(utils.highlight-add :LspDiagnosticsDefaultInformation {:bg "#272d2f"})
(utils.highlight-add :DiagnosticError {:fg colors.bright_red})
(utils.highlight-add :DiagnosticWarning {:fg colors.bright_orange})
(utils.highlight-add :DiagnosticInformation {:fg colors.bright_aqua})
(utils.highlight-add :DiagnosticHint {:fg colors.bright_yellow})
(utils.highlight-add :LspDiagnosticsDefaultHint {:bg "#272d2f"})
(utils.highlight-add :DiagnosticVirtualTextError {:bg "#342828" :fg colors.bright_red})
(utils.highlight-add :DiagnosticVirtualTextWarning {:bg "#473027" :fg colors.bright_orange})
(utils.highlight-add :DiagnosticVirtualTextWarning {:bg "#3b2c28" :fg colors.bright_orange})
(utils.highlight-add :DiagnosticVirtualTextInformation {:bg "#272d2f" :fg colors.bright_aqua})
(utils.highlight-add :DiagnosticVirtualTextHint {:bg "#272d2f" :fg colors.bright_yellow})
(utils.highlight :LspDiagnosticsUnderlineError {:gui "undercurl"})
(vim.fn.sign_define :LspDiagnosticsSignError {:text "◆"})
(vim.fn.sign_define :LspDiagnosticsSignWarning {:text "◆"})
(vim.fn.sign_define :LspDiagnosticsSignHint {:text "◆"})
(vim.fn.sign_define :LspDiagnosticsSignInformation {:text "◆"})
(utils.highlight ["StatusLine" "GalaxyLineInfo" "GalaxySpace" ] {:bg colors.dark1 :fg colors.light0})
(utils.highlight :StatusLine {:bg colors.dark1 :fg colors.light0})
(vim.cmd "highlight link Function GruvboxGreen")
(utils.highlight-add :Function {:gui "NONE"})
@ -130,10 +136,6 @@
(vim.fn.sign_define :LspDiagnosticsSignError {:text "◆"})
(vim.fn.sign_define :LspDiagnosticsSignWarning {:text "◆"})
(vim.fn.sign_define :LspDiagnosticsSignHint {:text "◆"})
(vim.fn.sign_define :LspDiagnosticsSignInformation {:text "◆"})