mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-11-06 03:12:24 +00:00
Show path in bar
This commit is contained in:
parent
bb5a09d16a
commit
29bc68c151
4 changed files with 61 additions and 43 deletions
|
@ -10,6 +10,8 @@
|
||||||
:cmd ["Telescope"]
|
:cmd ["Telescope"]
|
||||||
:requires [:nvim-lua/popup.nvim :nvim-lua/plenary.nvim]}
|
:requires [:nvim-lua/popup.nvim :nvim-lua/plenary.nvim]}
|
||||||
|
|
||||||
|
:kyazdani42/nvim-web-devicons {}
|
||||||
|
|
||||||
:p00f/nvim-ts-rainbow {}
|
:p00f/nvim-ts-rainbow {}
|
||||||
:romgrk/nvim-treesitter-context {}
|
:romgrk/nvim-treesitter-context {}
|
||||||
:JoosepAlviste/nvim-ts-context-commentstring {}
|
:JoosepAlviste/nvim-ts-context-commentstring {}
|
||||||
|
@ -107,6 +109,8 @@
|
||||||
:simrat39/rust-tools.nvim {:ft ["rust"]}
|
:simrat39/rust-tools.nvim {:ft ["rust"]}
|
||||||
:ray-x/lsp_signature.nvim {}
|
:ray-x/lsp_signature.nvim {}
|
||||||
|
|
||||||
|
:vmchale/ats-vim {:ft ["ats"]}
|
||||||
|
|
||||||
:bakpakin/fennel.vim {})
|
:bakpakin/fennel.vim {})
|
||||||
; >>>
|
; >>>
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
colors colors}})
|
colors colors}})
|
||||||
|
|
||||||
; :h bufferline-lua-highlights
|
; :h bufferline-lua-highlights
|
||||||
(let [selected {:guibg colors.neutral_aqua :guifg colors.dark0 :gui ""}
|
(let [selected {:gui "" :guibg colors.neutral_aqua :guifg colors.dark0}
|
||||||
visible {:guibg colors.dark1 :guifg colors.neutral_aqua :gui ""}]
|
visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_aqua}]
|
||||||
(bufferline.setup
|
(bufferline.setup
|
||||||
{:options
|
{:options
|
||||||
{:diagnostics "nvim_lsp"
|
{:diagnostics "nvim_lsp"
|
||||||
:diagnostics_indicator (fn [cnt lvl diagnostics-dict] (.. " (" cnt ")"))
|
:diagnostics_indicator (fn [cnt lvl diagnostics-dict] (.. " (" cnt ")"))
|
||||||
:show_buffer_close_icons false
|
:show_buffer_close_icons false
|
||||||
|
:show_buffer_icons false
|
||||||
:show_close_icon false
|
:show_close_icon false
|
||||||
:show_tab_indicators false
|
:show_tab_indicators false
|
||||||
:enforce_regular_tabs false
|
:enforce_regular_tabs false
|
||||||
|
@ -39,18 +40,22 @@
|
||||||
:duplicate_visible visible
|
:duplicate_visible visible
|
||||||
:duplicate_selected selected
|
:duplicate_selected selected
|
||||||
|
|
||||||
:diagnostic {:gui "" :guibg colors.dark1 :guifg colors.neutral_red}
|
:diagnostic {:gui "" :guibg colors.dark1 :guifg colors.neutral_red}
|
||||||
:diagnostic_visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_red}
|
:diagnostic_visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_red}
|
||||||
:diagnostic_selected {:gui "" :guibg colors.neutral_aqua :guifg colors.faded_red}
|
:diagnostic_selected {:gui "" :guibg colors.neutral_aqua :guifg colors.faded_red}
|
||||||
|
|
||||||
:info_diagnostic {:gui "" :guibg colors.dark1 :guifg colors.neutral_blue}
|
:info_diagnostic {:gui "" :guibg colors.dark1 :guifg colors.neutral_blue}
|
||||||
:info_diagnostic_visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_blue}
|
:info_diagnostic_visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_blue}
|
||||||
:info_diagnostic_selected {:gui "" :guibg colors.neutral_aqua :guifg colors.faded_blue}
|
:info_diagnostic_selected {:gui "" :guibg colors.neutral_aqua :guifg colors.faded_blue}
|
||||||
|
|
||||||
:warning_diagnostic {:gui "" :guibg colors.dark1 :guifg colors.neutral_yellow}
|
:warning_diagnostic {:gui "" :guibg colors.dark1 :guifg colors.neutral_yellow}
|
||||||
:warning_diagnostic_visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_yellow}
|
:warning_diagnostic_visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_yellow}
|
||||||
:warning_diagnostic_selected {:gui "" :guibg colors.neutral_aqua :guifg colors.faded_yellow}
|
:warning_diagnostic_selected {:gui "" :guibg colors.neutral_aqua :guifg colors.faded_yellow}
|
||||||
|
|
||||||
|
:error_diagnostic {:gui "" :guibg colors.dark1 :guifg colors.neutral_red}
|
||||||
|
:error_diagnostic_visible {:gui "" :guibg colors.dark1 :guifg colors.neutral_red}
|
||||||
|
:error_diagnostic_selected {:gui "" :guibg colors.neutral_aqua :guifg colors.red}
|
||||||
|
|
||||||
:separator visible
|
:separator visible
|
||||||
:indicator_selected {:guibg colors.neutral_aqua :guifg colors.neutral_aqua}
|
:indicator_selected {:guibg colors.neutral_aqua :guifg colors.neutral_aqua}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
(module plugins.galaxyline
|
(module plugins.galaxyline
|
||||||
{require {a aniseed.core
|
{require {a aniseed.core
|
||||||
|
str aniseed.string
|
||||||
fennel aniseed.fennel
|
fennel aniseed.fennel
|
||||||
nvim aniseed.nvim
|
nvim aniseed.nvim
|
||||||
utils utils
|
utils utils
|
||||||
|
@ -18,7 +19,7 @@
|
||||||
(local modes
|
(local modes
|
||||||
{:n {:text "NORMAL" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
|
{:n {:text "NORMAL" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
:i {:text "INSERT" :colors {:bg colors.neutral_yellow :fg colors.dark0}}
|
:i {:text "INSERT" :colors {:bg colors.neutral_yellow :fg colors.dark0}}
|
||||||
:c {:text "CMD" :colors {:bg colors.neutral_aqua :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}}
|
:ce {:text "NORMEX" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
:cv {:text "EX" :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}}
|
:ic {:text "INSCOMP" :colors {:bg colors.neutral_aqua :fg colors.dark0}}
|
||||||
|
@ -34,52 +35,46 @@
|
||||||
:V {:text "VISUAL LINE" :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}}})
|
"" {:text "VISUAL BLOCK" :colors {:bg colors.neutral_blue :fg colors.dark0}}})
|
||||||
|
|
||||||
|
(fn get-current-filename []
|
||||||
|
(nvim.fn.expand "%:t"))
|
||||||
|
|
||||||
(fn buf-name-empty? []
|
(fn get-current-filepath []
|
||||||
(a.empty? (nvim.fn.expand "%:t")))
|
(let [file (utils.shorten-path (vim.fn.bufname) 5 50)]
|
||||||
|
|
||||||
(fn get-current-file-name []
|
|
||||||
(let [file (nvim.fn.expand "%:t")]
|
|
||||||
(if (a.empty? file) ""
|
(if (a.empty? file) ""
|
||||||
nvim.bo.readonly (.. "RO " file)
|
nvim.bo.readonly (.. "RO " file)
|
||||||
(and nvim.bo.modifiable nvim.bo.modified) (.. file " ")
|
(and nvim.bo.modifiable nvim.bo.modified) (.. file " ")
|
||||||
file)))
|
file)))
|
||||||
|
|
||||||
(fn get-mode-data []
|
|
||||||
(or (. modes (nvim.fn.mode))
|
|
||||||
{:text (nvim.fn.mode)
|
|
||||||
:colors {:bg colors.neutral_orange :fg colors.dark0}}))
|
|
||||||
|
|
||||||
(fn vim-mode-provider []
|
|
||||||
(let [modedata (get-mode-data)]
|
|
||||||
(utils.highlight "GalaxyViMode" modedata.colors)
|
|
||||||
(.. " " modedata.text " ")))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(set galaxyline.short_line_list ["dbui" "diff" "peekaboo" "undotree" "vista" "vista_markdown"])
|
(set galaxyline.short_line_list ["dbui" "diff" "peekaboo" "undotree" "vista" "vista_markdown"])
|
||||||
|
|
||||||
|
|
||||||
(set galaxyline.section.left
|
|
||||||
[{:ViMode {:provider vim-mode-provider}}
|
|
||||||
{:FileName {:provider get-current-file-name
|
|
||||||
:highlight [colors.light4 bar-bg-col]}}
|
|
||||||
{:Space {:provider (fn [] "")
|
|
||||||
:highlight [colors.light0 bar-bg-col]}}])
|
|
||||||
|
|
||||||
(fn make-lsp-diagnostic-provider [kind]
|
(fn make-lsp-diagnostic-provider [kind]
|
||||||
(fn []
|
(fn []
|
||||||
(let [n (vim.lsp.diagnostic.get_count 0 kind)]
|
(let [n (vim.lsp.diagnostic.get_count 0 kind)]
|
||||||
(if (= n 0) "" (.. " " n " ")))))
|
(if (= n 0) "" (.. " " n " ")))))
|
||||||
|
|
||||||
(fn git-branch-provider []
|
|
||||||
(let [branch (gl-vcs.get_git_branch)]
|
(set galaxyline.section.left
|
||||||
(if (= "master" branch) "" branch)))
|
[{: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
|
(set galaxyline.section.right
|
||||||
[{:GitBranch {:provider git-branch-provider
|
[{:GitBranch {:highlight [colors.light4 bar-bg-col]
|
||||||
:highlight [colors.light4 bar-bg-col]}}
|
:provider
|
||||||
{:FileType {:provider (fn [] nvim.bo.filetype)
|
#(let [branch (gl-vcs.get_git_branch)]
|
||||||
|
(if (= "master" branch) "" branch))}}
|
||||||
|
|
||||||
|
{:FileType {:provider #nvim.bo.filetype
|
||||||
:highlight [colors.neutral_aqua bar-bg-col]}}
|
:highlight [colors.neutral_aqua bar-bg-col]}}
|
||||||
|
|
||||||
{:DiagnosticInfo {:provider (make-lsp-diagnostic-provider "Info")
|
{:DiagnosticInfo {:provider (make-lsp-diagnostic-provider "Info")
|
||||||
|
@ -90,7 +85,7 @@
|
||||||
{:DiagnosticError {:provider (make-lsp-diagnostic-provider "Error")
|
{:DiagnosticError {:provider (make-lsp-diagnostic-provider "Error")
|
||||||
:highlight [colors.dark1 colors.bright_red]
|
:highlight [colors.dark1 colors.bright_red]
|
||||||
:separator ""}}
|
:separator ""}}
|
||||||
{:LineInfo {:provider (fn [] (.. " " (gl-fileinfo.line_column) " "))
|
{:LineInfo {:provider #(.. " " (gl-fileinfo.line_column) " ")
|
||||||
:highlight "GalaxyViMode"
|
:highlight "GalaxyViMode"
|
||||||
:separator ""}}])
|
:separator ""}}])
|
||||||
|
|
||||||
|
@ -110,3 +105,5 @@
|
||||||
(set galaxyline.section.right (map-gl-section add-segment-defaults galaxyline.section.right)))
|
(set galaxyline.section.right (map-gl-section add-segment-defaults galaxyline.section.right)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
(module utils
|
(module utils
|
||||||
{autoload {a aniseed.core
|
{autoload {a aniseed.core
|
||||||
fennel aniseed.fennel
|
fennel aniseed.fennel
|
||||||
nvim aniseed.nvim}
|
nvim aniseed.nvim
|
||||||
|
str aniseed.string}
|
||||||
require-macros [macros]})
|
require-macros [macros]})
|
||||||
|
|
||||||
(defn plugin-installed? [name]
|
(defn plugin-installed? [name]
|
||||||
|
@ -92,6 +93,17 @@
|
||||||
(surround-if-present " gui='"colset.gui"'")))))
|
(surround-if-present " gui='"colset.gui"'")))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn shorten-path [path seg-length shorten-after]
|
||||||
|
"shorten a filepath by truncating the segments to n characters, if the path exceeds a given length"
|
||||||
|
(let [segments (str.split path "/")]
|
||||||
|
(if (or (> shorten-after (length path))
|
||||||
|
(> 2 (length segments)))
|
||||||
|
path
|
||||||
|
(let [init (a.butlast segments)
|
||||||
|
filename (a.last segments)
|
||||||
|
shortened-segs (a.map #(string.sub $1 1 seg-length) init)]
|
||||||
|
(.. (str.join "/" shortened-segs) "/" filename)))))
|
||||||
|
|
||||||
(defn comp [f g]
|
(defn comp [f g]
|
||||||
(fn [...]
|
(fn [...]
|
||||||
(f (g ...))))
|
(f (g ...))))
|
||||||
|
|
Loading…
Reference in a new issue