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,6 +10,8 @@
|
|||
feline-lsp feline.providers.lsp}
|
||||
require-macros [macros]})
|
||||
|
||||
(set vim.opt.termguicolors true)
|
||||
|
||||
(local modes
|
||||
{:n {:text "NORMAL" :color colors.neutral_aqua}
|
||||
:i {:text "INSERT" :color colors.neutral_yellow}
|
||||
|
@ -29,27 +31,19 @@
|
|||
: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 horiz-separator-color colors.light1)
|
||||
|
||||
(defn or-empty [x] (or x ""))
|
||||
(defn spaces [x] (if x (.. " " x " ") ""))
|
||||
|
||||
(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) ""
|
||||
nvim.bo.readonly (.. "RO " file)
|
||||
(and nvim.bo.modifiable nvim.bo.modified) (.. 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?]
|
||||
(let [color (. modes (vim.fn.mode) :color)]
|
||||
(if use-as-fg? {:bg bar-bg :fg color} {:bg color :fg bar-bg})))
|
||||
|
@ -58,6 +52,8 @@
|
|||
(or-empty (utils.keep-if #(~= "master" $1)
|
||||
(?. vim.b :gitsigns_status_dict :head))))
|
||||
|
||||
(defn vim-mode []
|
||||
(.. " " (or (. modes (vim.fn.mode) :text) vim.fn.mode) " "))
|
||||
|
||||
(defn lsp-progress-provider []
|
||||
(let [msgs (vim.lsp.util.get_progress_messages)
|
||||
|
@ -66,34 +62,53 @@
|
|||
(.. msg.title " " msg.message)))]
|
||||
(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 {}})
|
||||
|
||||
(tset components.active 1
|
||||
[{:provider #(.. " " (or (. modes (vim.fn.mode) :text) vim.fn.mode) " ")
|
||||
:hl #(vim-mode-hl false)}
|
||||
[{:provider vim-mode :hl #(vim-mode-hl false)}
|
||||
{:provider get-current-filepath :left_sep " "}
|
||||
{:provider git-status-provider :left_sep " " :hl #(vim-mode-hl true)}])
|
||||
|
||||
(tset components.active 2
|
||||
[{:provider lsp-progress-provider
|
||||
:left_sep " "
|
||||
:right_sep " "
|
||||
:enabled #(< 0 (length (vim.lsp.buf_get_clients)))}])
|
||||
|
||||
|
||||
(tset components.active 3
|
||||
[{:provider #vim.bo.filetype
|
||||
:hl #(vim-mode-hl true)
|
||||
:right_sep " "}
|
||||
(lsp-diagnostic-component "Information" colors.neutral_purple)
|
||||
(lsp-diagnostic-component "Hint" colors.neutral_blue)
|
||||
(lsp-diagnostic-component "Warn" colors.neutal_yellow)
|
||||
[{:provider vim.bo.filetype :right_sep " " :hl #(vim-mode-hl true)}
|
||||
(lsp-diagnostic-component "Information" colors.neutral_green)
|
||||
(lsp-diagnostic-component "Hint" colors.neutral_aqua)
|
||||
(lsp-diagnostic-component "Warning" colors.neutral_yellow)
|
||||
(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)}])
|
||||
{:provider coordinates :hl #(vim-mode-hl false)}])
|
||||
|
||||
(tset components.inactive 1
|
||||
[{:provider inactive-separator-provider
|
||||
:hl {:bg "NONE" :fg horiz-separator-color}}])
|
||||
|
||||
(feline.setup
|
||||
{:colors {:bg bar-bg
|
||||
:fg colors.dark4}
|
||||
{:colors {:fg colors.dark4 :bg colors.dark0}
|
||||
:default_hl {:inactive
|
||||
{:fg horiz-separator-color
|
||||
:bg "NONE"}}
|
||||
:components components})
|
||||
|
||||
|
|
Loading…
Reference in a new issue