mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-11-06 03:12:24 +00:00
Steal some of drusks changes to feline config
This commit is contained in:
parent
4abaf5a870
commit
ec67bebca0
1 changed files with 76 additions and 61 deletions
|
@ -10,90 +10,105 @@
|
||||||
feline-lsp feline.providers.lsp}
|
feline-lsp feline.providers.lsp}
|
||||||
require-macros [macros]})
|
require-macros [macros]})
|
||||||
|
|
||||||
(local modes
|
(set vim.opt.termguicolors true)
|
||||||
{:n {:text "NORMAL" :color colors.neutral_aqua}
|
|
||||||
:i {:text "INSERT" :color colors.neutral_yellow}
|
(local modes
|
||||||
:c {:text "CMMAND" :color colors.neutral_aqua}
|
{:n {:text "NORMAL" :color colors.neutral_aqua}
|
||||||
:ce {:text "NORMEX" :color colors.neutral_aqua}
|
:i {:text "INSERT" :color colors.neutral_yellow}
|
||||||
:cv {:text "EX" :color colors.neutral_aqua}
|
:c {:text "CMMAND" :color colors.neutral_aqua}
|
||||||
:ic {:text "INSCOMP" :color colors.neutral_aqua}
|
:ce {:text "NORMEX" :color colors.neutral_aqua}
|
||||||
:no {:text "OP-PENDING" :color colors.neutral_aqua}
|
:cv {:text "EX" :color colors.neutral_aqua}
|
||||||
:r {:text "HIT-ENTER" :color colors.neutral_aqua}
|
:ic {:text "INSCOMP" :color colors.neutral_aqua}
|
||||||
:r? {:text "CONFIRM" :color colors.neutral_aqua}
|
:no {:text "OP-PENDING" :color colors.neutral_aqua}
|
||||||
:R {:text "REPLACE" :color colors.neutral_aqua}
|
:r {:text "HIT-ENTER" :color colors.neutral_aqua}
|
||||||
:Rv {:text "VIRTUAL" :color colors.neutral_aqua}
|
:r? {:text "CONFIRM" :color colors.neutral_aqua}
|
||||||
:s {:text "SELECT" :color colors.neutral_aqua}
|
:R {:text "REPLACE" :color colors.neutral_aqua}
|
||||||
:S {:text "SELECT" :color colors.neutral_aqua}
|
:Rv {:text "VIRTUAL" :color colors.neutral_aqua}
|
||||||
:t {:text "TERM" :color colors.neutral_aqua}
|
:s {:text "SELECT" :color colors.neutral_aqua}
|
||||||
:v {:text "VISUAL" :color colors.neutral_blue}
|
:S {:text "SELECT" :color colors.neutral_aqua}
|
||||||
:V {:text "VISUAL LINE" :color colors.neutral_blue}
|
:t {:text "TERM" :color colors.neutral_aqua}
|
||||||
"" {:text "VISUAL BLOCK" :color colors.neutral_blue}})
|
:v {:text "VISUAL" :color colors.neutral_blue}
|
||||||
|
:V {:text "VISUAL LINE" :color colors.neutral_blue}
|
||||||
|
"" {:text "VISUAL BLOCK" :color colors.neutral_blue}})
|
||||||
|
|
||||||
;(def bar-bg colors.dark1)
|
|
||||||
(def bar-bg colors.dark0)
|
(def bar-bg colors.dark0)
|
||||||
|
(def horiz-separator-color colors.light1)
|
||||||
|
|
||||||
(defn or-empty [x] (or x ""))
|
(defn or-empty [x] (or x ""))
|
||||||
(defn spaces [x] (if x (.. " " x " ") ""))
|
(defn spaces [x] (if x (.. " " x " ") ""))
|
||||||
|
|
||||||
(defn get-current-filepath []
|
(defn get-current-filepath []
|
||||||
(let [file (utils.shorten-path (vim.fn.bufname) 5 50)]
|
(let [file (utils.shorten-path (vim.fn.bufname) 5 30)]
|
||||||
(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 " "))))
|
||||||
|
|
||||||
(defn lsp-diagnostic-component [kind color]
|
|
||||||
{:enabled #(~= 0 (vim.lsp.diagnostic.get_count 0 kind))
|
|
||||||
:provider #(spaces (vim.lsp.diagnostic.get_count 0 kind))
|
|
||||||
:left_sep ""
|
|
||||||
:right_sep ""
|
|
||||||
:hl {:fg bar-bg :bg color}})
|
|
||||||
|
|
||||||
|
|
||||||
(defn vim-mode-hl [use-as-fg?]
|
(defn vim-mode-hl [use-as-fg?]
|
||||||
(let [color (. modes (vim.fn.mode) :color)]
|
(let [color (. modes (vim.fn.mode) :color)]
|
||||||
(if use-as-fg? {:bg bar-bg :fg color} {:bg color :fg bar-bg})))
|
(if use-as-fg? {:bg bar-bg :fg color} {:bg color :fg bar-bg})))
|
||||||
|
|
||||||
(defn git-status-provider []
|
(defn git-status-provider []
|
||||||
(or-empty (utils.keep-if #(~= "master" $1)
|
(or-empty (utils.keep-if #(~= "master" $1)
|
||||||
(?. vim.b :gitsigns_status_dict :head))))
|
(?. vim.b :gitsigns_status_dict :head))))
|
||||||
|
|
||||||
|
(defn vim-mode []
|
||||||
|
(.. " " (or (. modes (vim.fn.mode) :text) vim.fn.mode) " "))
|
||||||
|
|
||||||
(defn lsp-progress-provider []
|
(defn lsp-progress-provider []
|
||||||
(let [msgs (vim.lsp.util.get_progress_messages)
|
(let [msgs (vim.lsp.util.get_progress_messages)
|
||||||
s (icollect [_ msg (ipairs msgs)]
|
s (icollect [_ msg (ipairs msgs)]
|
||||||
(when msg.message
|
(when msg.message
|
||||||
(.. msg.title " " msg.message)))]
|
(.. msg.title " " msg.message)))]
|
||||||
(or-empty (str.join " | " s))))
|
(or-empty (str.join " | " s))))
|
||||||
|
|
||||||
|
(defn lsp-diagnostic-component [kind color]
|
||||||
|
{:enabled #(~= 0 (vim.lsp.diagnostic.get_count 0 kind))
|
||||||
|
:provider #(spaces (vim.lsp.diagnostic.get_count 0 kind))
|
||||||
|
:left_sep ""
|
||||||
|
:right_sep ""
|
||||||
|
:hl {:fg bar-bg :bg color}})
|
||||||
|
|
||||||
|
(defn coordinates []
|
||||||
|
(let [[line col] (vim.api.nvim_win_get_cursor 0)]
|
||||||
|
(.. " #" line " ")))
|
||||||
|
|
||||||
|
|
||||||
|
; Fills the bar with an horizontal line
|
||||||
|
(defn inactive-separator-provider []
|
||||||
|
(if (not= (vim.fn.winnr) (vim.fn.winnr :j))
|
||||||
|
(string.rep "─" (vim.api.nvim_win_get_width 0))
|
||||||
|
""))
|
||||||
|
|
||||||
(def components {:active {} :inactive {}})
|
(def components {:active {} :inactive {}})
|
||||||
|
|
||||||
(tset components.active 1
|
(tset components.active 1
|
||||||
[{:provider #(.. " " (or (. modes (vim.fn.mode) :text) vim.fn.mode) " ")
|
[{:provider vim-mode :hl #(vim-mode-hl false)}
|
||||||
:hl #(vim-mode-hl false)}
|
{:provider get-current-filepath :left_sep " "}
|
||||||
{:provider get-current-filepath :left_sep " "}
|
{:provider git-status-provider :left_sep " " :hl #(vim-mode-hl true)}])
|
||||||
{:provider git-status-provider :left_sep " " :hl #(vim-mode-hl true)}])
|
|
||||||
|
|
||||||
(tset components.active 2
|
(tset components.active 2
|
||||||
[{:provider lsp-progress-provider
|
[{:provider lsp-progress-provider
|
||||||
:enabled #(< 0 (length (vim.lsp.buf_get_clients)))}])
|
:left_sep " "
|
||||||
|
:right_sep " "
|
||||||
|
:enabled #(< 0 (length (vim.lsp.buf_get_clients)))}])
|
||||||
|
|
||||||
(tset components.active 3
|
(tset components.active 3
|
||||||
[{:provider #vim.bo.filetype
|
[{:provider vim.bo.filetype :right_sep " " :hl #(vim-mode-hl true)}
|
||||||
:hl #(vim-mode-hl true)
|
(lsp-diagnostic-component "Information" colors.neutral_green)
|
||||||
:right_sep " "}
|
(lsp-diagnostic-component "Hint" colors.neutral_aqua)
|
||||||
(lsp-diagnostic-component "Information" colors.neutral_purple)
|
(lsp-diagnostic-component "Warning" colors.neutral_yellow)
|
||||||
(lsp-diagnostic-component "Hint" colors.neutral_blue)
|
(lsp-diagnostic-component "Error" colors.neutral_red)
|
||||||
(lsp-diagnostic-component "Warn" colors.neutal_yellow)
|
{:provider coordinates :hl #(vim-mode-hl false)}])
|
||||||
(lsp-diagnostic-component "Error" colors.neutral_red)
|
|
||||||
{:provider #(let [[line col] (vim.api.nvim_win_get_cursor 0)] (.. " " line ":" col " "))
|
|
||||||
:hl #(vim-mode-hl false)}])
|
|
||||||
|
|
||||||
|
(tset components.inactive 1
|
||||||
|
[{:provider inactive-separator-provider
|
||||||
|
:hl {:bg "NONE" :fg horiz-separator-color}}])
|
||||||
|
|
||||||
(feline.setup
|
(feline.setup
|
||||||
{:colors {:bg bar-bg
|
{:colors {:fg colors.dark4 :bg colors.dark0}
|
||||||
:fg colors.dark4}
|
:default_hl {:inactive
|
||||||
:components components})
|
{:fg horiz-separator-color
|
||||||
|
:bg "NONE"}}
|
||||||
|
:components components})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue