about summary refs log tree commit diff
path: root/fnl/nvrc/packs/feline.fnl
blob: 4953a7ddc6e4ad858bff726fea00384459d3742d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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})