try out feline

This commit is contained in:
elkowar 2021-05-15 21:10:36 +02:00
parent f7076e8a26
commit ef11d26a1a
No known key found for this signature in database
GPG key ID: E321AD71B1D1F27F
8 changed files with 292 additions and 9 deletions

View file

@ -46,7 +46,8 @@ in
#normal.family = "Iosevka"; #normal.family = "Iosevka";
normal.family = "Terminus (TTF)"; normal.family = "Terminus (TTF)";
offset.x = 0; offset.x = 0;
offset.y = -2; #offset.y = -2;
offset.y = 0;
}; };
colors = config.elkowar.desktop.colors; colors = config.elkowar.desktop.colors;
}; };

View file

@ -60,7 +60,6 @@
(se wrap false) (se wrap false)
(se completeopt "menuone,noselect") (se completeopt "menuone,noselect")
(se laststatus 2) (se laststatus 2)
(se showmode true)
(se splitbelow true) (se splitbelow true)
(se splitright true) (se splitright true)
(se mouse "a") (se mouse "a")

View file

@ -20,8 +20,8 @@
:dbg :dbg
(fn [x] (fn [x]
`(let [view# (. (require "aniseed.fennel") :view)] `(let [view# (require "aniseed.view")]
(print (.. `,(tostring x) " => " (view# ,x))) (print (.. `,(tostring x) " => " (view#.serialise ,x)))
,x)) ,x))
:dbg-call :dbg-call

View file

@ -36,12 +36,17 @@
; general purpose lua wrappers for nvim stuff ; general purpose lua wrappers for nvim stuff
:norcalli/nvim.lua {} :norcalli/nvim.lua {}
:glepnir/galaxyline.nvim {:mod "plugins.galaxyline" ;:glepnir/galaxyline.nvim {:mod "plugins.galaxyline"
;:after "gruvbox"}
:Famiu/feline.nvim {:mod "plugins.feline"
:after "gruvbox"} :after "gruvbox"}
;:gwimm/lililine.nvim {:after "gruvbox"} ;:gwimm/lililine.nvim {:after "gruvbox"
;:mod "plugins.lililine"}
:akinsho/nvim-bufferline.lua {:mod "plugins.bufferline"} :akinsho/nvim-bufferline.lua {:mod "plugins.bufferline"}
;:romgrk/barbar.nvim {:mod "plugins.barbar"}
:sindrets/diffview.nvim {:mod "plugins.diffview"} :sindrets/diffview.nvim {:mod "plugins.diffview"}
:tweekmonster/startuptime.vim {:cmd ["StartupTime"]} :tweekmonster/startuptime.vim {:cmd ["StartupTime"]}
@ -88,7 +93,9 @@
:tommcdo/vim-exchange {} :tommcdo/vim-exchange {}
;:frazrepo/vim-rainbow {} ;:frazrepo/vim-rainbow {}
:bhurlow/vim-parinfer {:ft ["fennel" "carp" "lisp" "elisp"]} ;:bhurlow/vim-parinfer {:ft ["fennel" "carp" "lisp" "elisp"]}
:eraserhd/parinfer-rust {:run "cargo build --release"}
:bduggan/vim-raku {:ft ["raku"]} :bduggan/vim-raku {:ft ["raku"]}
:LnL7/vim-nix {:ft ["nix"]} :LnL7/vim-nix {:ft ["nix"]}

View file

@ -0,0 +1,7 @@
(module utils
{autoload {a aniseed.core
fennel aniseed.fennel
nvim aniseed.nvim
str aniseed.string}
require-macros [macros]})

View file

@ -0,0 +1,103 @@
(module utils
{autoload {a aniseed.core
nvim aniseed.nvim
utils utils
str aniseed.string
colors colors
view aniseed.view
feline feline
feline-git feline.providers.git
feline-lsp feline.providers.lsp}
require-macros [macros]})
(local modes
{:n {:text "NORMAL" :color colors.neutral_aqua}
:i {:text "INSERT" :color colors.neutral_yellow}
:c {:text "CMMAND" :color colors.neutral_aqua}
:ce {:text "NORMEX" :color colors.neutral_aqua}
:cv {:text "EX" :color colors.neutral_aqua}
:ic {:text "INSCOMP" :color colors.neutral_aqua}
:no {:text "OP-PENDING" :color colors.neutral_aqua}
:r {:text "HIT-ENTER" :color colors.neutral_aqua}
:r? {:text "CONFIRM" :color colors.neutral_aqua}
:R {:text "REPLACE" :color colors.neutral_aqua}
:Rv {:text "VIRTUAL" :color colors.neutral_aqua}
:s {:text "SELECT" :color colors.neutral_aqua}
:S {:text "SELECT" :color colors.neutral_aqua}
:t {:text "TERM" :color colors.neutral_aqua}
: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)
(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)]
(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})))
(defn git-status-provider []
(or-empty (utils.keep-if #(~= "master" $1)
(?. vim.b :gitsigns_status_dict :head))))
(def components
{:left {:active {} :inactive {}}
:mid {:active {} :inactive {}}
:right {:active {} :inactive {}}})
(set components.left.active
[{:provider #(.. " " (or (. modes (vim.fn.mode) :text) vim.fn.mode) " ")
:hl #(vim-mode-hl false)}
{:provider get-current-filepath :left_sep " "}
{:provider git-status-provider :left_sep " " :hl #(vim-mode-hl true)}])
(defn get-lsp-progress []
(let [msgs (vim.lsp.util.get_progress_messages)
s (icollect [_ msg (ipairs msgs)]
(when msg.message
(.. msg.title " " msg.message)))]
(or-empty (str.join " | " s))))
(set components.mid.active
[{:provider get-lsp-progress}])
(set components.right.active
[{:provider vim.bo.filetype
:right_sep " "
:hl #(vim-mode-hl true)}
(lsp-diagnostic-component "Information" colors.neutral_purple)
(lsp-diagnostic-component "Hint" colors.neutral_blue)
(lsp-diagnostic-component "Warn" colors.neutal_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)}])
(feline.setup
{:default_bg bar-bg
:default_fg colors.dark4
:components components})

View file

@ -0,0 +1,166 @@
(module plugins.lililine
{require {a aniseed.core
str aniseed.string
nvim aniseed.nvim
utils utils
colors 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

@ -4,4 +4,4 @@
(set vim.g.sneak#label 1) (set vim.g.sneak#label 1)
(utils.keymap [:n :o] :<DEL> "<Plug>Sneak_s" {:noremap false}) (utils.keymap [:n :o] :<DEL> "<Plug>Sneak_s" {:noremap false})
(utils.keymap [:n :o] :<S-DEL> "<Plug>Sneak_s" {:noremap false}) (utils.keymap [:n :o] :<S-DEL> "<Plug>Sneak_S" {:noremap false})