about summary refs log tree commit diff
path: root/fnl/nvrc/packs/feline.fnl
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-02-10 00:24:03 +0900
committersefidel <contact@sefidel.net>2022-02-10 00:24:03 +0900
commit72d448e384249103748ee83b587c45924e4bc44d (patch)
tree2aa05a6aaf8c7aa37a8c278fd2fede6e62ff2218 /fnl/nvrc/packs/feline.fnl
downloadnvimrc-72d448e384249103748ee83b587c45924e4bc44d.tar.gz
nvimrc-72d448e384249103748ee83b587c45924e4bc44d.zip
Initial commit
Diffstat (limited to 'fnl/nvrc/packs/feline.fnl')
-rw-r--r--fnl/nvrc/packs/feline.fnl144
1 files changed, 144 insertions, 0 deletions
diff --git a/fnl/nvrc/packs/feline.fnl b/fnl/nvrc/packs/feline.fnl
new file mode 100644
index 0000000..4953a7d
--- /dev/null
+++ b/fnl/nvrc/packs/feline.fnl
@@ -0,0 +1,144 @@
+(local feline (require :feline))
+(local lsp (require :feline.providers.lsp))
+(local lsp_severity vim.diagnostic.severity)
+(local vi_mode (require :feline.providers.vi_mode))
+(local git (require :feline.providers.git))
+
+(local colors (require :nvrc.colors))
+(local utils (require :nvrc.utils))
+
+(local vi_mode_colors {:NORMAL (. colors :green)
+                       :INSERT (. colors :red)
+                       :VISUAL (. colors :yellow)
+                       :OP (. colors :green)
+                       :BLOCK (. colors :skyblue)
+                       :REPLACE (. colors :violet)
+                       :V-REPLACE (. colors :violet)
+                       :ENTER (. colors :skyblue)
+                       :MORE (. colors :skyblue)
+                       :SELECT (. colors :orange)
+                       :COMMAND (. colors :green)
+                       :SHELL (. colors :green)
+                       :TERM (. colors :green)
+                       :NONE (. colors :yellow)})
+
+(local modules {:pad {:provider "▊ " :hl {:fg (. colors :skyblue)}}
+                :current_position {:provider :position
+                                   :left_sep " "
+                                   :right_sep {1 " "
+                                               2 {:str :vertical_bar_thin
+                                                  :hl {:fg :fg :bg :bg}}}}
+                :vi_mode {:provider :vi_mode
+                          :icon ""
+                          :right_sep " "
+                          :hl (fn []
+                                {:name (vi_mode.get_mode_highlight_name)
+                                 :fg (vi_mode.get_mode_color)})}
+                :file {:info {:provider {:name :file_info
+                                         :opts {:file_modified_icon "[+]"
+                                                :file_readonly_icon "!w "}}
+                              :icon ""
+                              :right_sep " "
+                              :hl {:fg (. colors :orange) :style :bold}}
+                       :encoding {:provider :file_encoding
+                                  :icon ""
+                                  :right_sep " "
+                                  :hl {:fg (. colors :magenta) :style :bold}}
+                       :type {:provider :file_type
+                              :icon ""
+                              :right_sep " "
+                              :hl {:fg (. colors :magenta) :style :bold}}
+                       :size {:provider :file_size
+                              :right_sep {1 " "
+                                          2 {:str :vertical_bar_thin
+                                             :hl {:fg :fg :bg :bg}}}}}
+                :line_percentage {:provider :line_percentage
+                                  :right_sep " "
+                                  :hl {:style :bold}}
+                :scroll_bar {:provider :scroll_bar
+                             :right_sep " "
+                             :hl {:fg (. colors :skyblue) :style :bold}}
+                :lsp {:name {:provider :lsp_client-names
+                             :icon ""
+                             :right_sep " "
+                             :hl {:fg (. colors :yellow)}}
+                      :load_fidget {:provider #(utils.lsp_fidget)
+                                    :enabled #(utils.will_it_fit 80)
+                                    :hl {:fg (. colors :green)}}
+                      :diag_err {:provider :diagnostic_errors
+                                 :enabled #(lsp.diagnostics_exist lsp_severity.ERROR)
+                                 :left_sep " "
+                                 :icon :E
+                                 :hl {:fg (. colors :red)}}
+                      :diag_warn {:provider :diagnostic_warnings
+                                  :enabled #(lsp.diagnostics_exist lsp_severity.WARN)
+                                  :left_sep " "
+                                  :icon :W
+                                  :hl {:fg (. colors :yellow)}}
+                      :diag_info {:provider :diagnostic_info
+                                  :enabled #(lsp.diagnostics_exist lsp_severity.INFO)
+                                  :left_sep " "
+                                  :icon :I
+                                  :hl {:fg (. colors :skyblue)}}
+                      :diag_hint {:provider :diagnostic_hints
+                                  :enabled #(lsp.diagnostics_exist lsp_severity.HINT)
+                                  :left_sep " "
+                                  :icon :H
+                                  :hl {:fg (. colors :white)}}}
+                :git {:branch {:provider :git_branch
+                               :enabled #(git.git_info_exists)
+                               :icon "*"
+                               :right_sep " "
+                               :hl {:fg (. colors :violet) :style :bold}}
+                      :add {:provider :git_diff_added
+                            :enabled #(git.git_info_exists)
+                            :icon "+"
+                            :right_sep " "
+                            :hl {:fg (. colors :green)}}
+                      :change {:provider :git_diff_changed
+                               :enabled #(git.git_info_exists)
+                               :icon "~"
+                               :right_sep " "
+                               :hl {:fg (. colors :orange)}}
+                      :remove {:provider :git_diff_removed
+                               :enabled #(git.git_info_exists)
+                               :icon "-"
+                               :right_sep " "
+                               :hl {:fg (. colors :red)}}}})
+
+(local comps {:left {:active [(. modules :pad)
+                              (. modules :vi_mode)
+                              (. modules :file :info)
+                              (. modules :file :size)
+                              (. modules :current_position)
+                              (. modules :lsp :diag_err)
+                              (. modules :lsp :diag_warn)
+                              (. modules :lsp :diag_info)
+                              (. modules :lsp :diag_hint)]
+                     :inactive []}
+              :middle {:active [(. modules :lsp :load_fidget)]
+                       :inactive []}
+              :right {:active [(. modules :git :branch)
+                               (. modules :git :add)
+                               (. modules :git :change)
+                               (. modules :git :remove)
+                               (. modules :file :encoding)
+                               (. modules :file :type)
+                               (. modules :line_percentage)
+                               (. modules :scroll_bar)]
+                      :inactive []}})
+
+(local components
+       {:active [comps.left.active comps.middle.active comps.right.active]
+        :inactive [comps.left.inactive comps.middle.inactive comps.right.inactive]})
+
+(local properties
+       {:force_inactive {:filetypes [:NvimTree :packer]
+                         :buftypes [:terminal :packer]}})
+
+(feline.setup {:theme colors
+               :default_bg (. colors :bg)
+               :default_fg (. colors :fg)
+               : components
+               : properties
+               : vi_mode_colors})