summaryrefslogtreecommitdiff
path: root/fnl/config/lualine.fnl
blob: 9674323eacee275c0a240a55100d70b117bd8f2e (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
;; Statusbar.
(module config.lualine {autoload {: util}})

(def- ignore [:help
              :packer
              :neogitstatus
              ;; :NvimTree
              :lir
              :spectre_panel
              :alpha
              :Outline
              :NeogitStatus
              :NeogitCommitMessage
              :TelescopePrompt])

(defn- active-clients [] (let [clients (vim.lsp.buf_get_clients)
                               client_names []]
                           (each [_ client (pairs clients)]
                             (if (not= client.name :null-ls)
                                 (table.insert client_names client.name)))
                           (if (> (length client_names) 0)
                               (table.concat client_names ", ")
                               "")))

(defn- hide-in-width [] (> (vim.fn.winwidth 0) 80))

(def- diagnostics {1 :diagnostics
                   :sources [:nvim_diagnostic]
                   :sections [:error :warn]
                   :symbols {:error " " :warn " "}
                   :colored false
                   :disabled_buftypes [:nvim-tree]
                   :padding 0
                   :update_in_insert false
                   :always_visible true})

(def- diff {1 :diff :colored false :disabled_buftypes [:nvim-tree] :cond hide-in-width})

(def- branch {1 "b:gitsigns_head" :icon " " :disabled_buftypes [:nvim-tree] :cond hide-in-width})

(def- filetype {1 :filetype :disabled_buftypes [:nvim-tree] :colored false :cond hide_in_width})

(def- language-server {1 active-clients :disabled_buftypes [:nvim-tree] :cond hide_in_width})

(def- opts {:options {:icons_enabled true
                      :theme :auto
                      :component_separators ""
                      :section_separators {:left "" :right ""}
                      :disabled_filetypes ignore
                      :always_divide_middle true
                      :globalstatus true
                      :refresh {:statusline 50}}
            :sections {:lualine_a [:mode]
                       :lualine_b [branch diff]
                       :lualine_c {}
                       :lualine_x [language-server diagnostics]
                       :lualine_y [filetype]
                       :lualine_z [:location :progress]}
            :inactive_sections {:lualine_a [:mode]
                                :lualine_b {}
                                :lualine_c {}
                                :lualine_x {}
                                :lualine_y {}
                                :lualine_z [:location :progress]}
            :extensions []})

(util.use-config :lualine opts)