about summary refs log tree commit diff
path: root/fnl/nvrc
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2022-03-06 20:44:10 +0900
committersefidel <contact@sefidel.net>2022-03-06 20:44:10 +0900
commitf98bb630c4bc3562749ffe6b5d18c6a06955af36 (patch)
treecc8cd0d8798ed04d2d855040993c6eef352d6968 /fnl/nvrc
parent5186760ef60dd0e16431125d9474e3d8d76eccba (diff)
downloadnvimrc-f98bb630c4bc3562749ffe6b5d18c6a06955af36.tar.gz
nvimrc-f98bb630c4bc3562749ffe6b5d18c6a06955af36.zip
feat!: UI rewrite
Diffstat (limited to 'fnl/nvrc')
-rw-r--r--fnl/nvrc/colors.fnl95
-rw-r--r--fnl/nvrc/macro/color.fnl5
-rw-r--r--fnl/nvrc/pack.fnl5
-rw-r--r--fnl/nvrc/packs/treesitter.fnl4
-rw-r--r--fnl/nvrc/ui/modules/misc.fnl14
-rw-r--r--fnl/nvrc/ui/modules/vi_mode.fnl40
-rw-r--r--fnl/nvrc/ui/statusline.fnl11
7 files changed, 21 insertions, 153 deletions
diff --git a/fnl/nvrc/colors.fnl b/fnl/nvrc/colors.fnl
index 9ba8742..1cba72c 100644
--- a/fnl/nvrc/colors.fnl
+++ b/fnl/nvrc/colors.fnl
@@ -1,93 +1,28 @@
 (import-macros {: setv!} :nvrc.macro.set)
 
-(local colors {:bg "#1d2021"
-               :bar "#32302f"
-               :fg "#d4be98"
-               :white "#e4be98"
-               :black "#1d2021"
-               :bblack "#3c3836"
-               :dgrey "#282828"
-               :mgrey "#504945"
-               :grey "#928374"
-               :red "#ea6962"
-               :orange "#e79a42"
-               :yellow "#d8a657"
-               :green "#a9b665"
-               :skyblue "#89b482"
-               :blue "#7daea3"
-               :violet "#d3869b"})
+(local colors {:bg "#292929"
+               :light_bg "#383838"
+               :graphite "#7d7d7d"
+               :red "#ff668c"
+               :yellow "#fac661"
+               :green "#a8d2a9"
+               :accent "#c2d6f0"})
 
 
 (lambda colors.apply [colorscheme]
-  (import-macros {: highlight! : link!} :nvrc.macro.color)
+  (import-macros {: highlight!} :nvrc.macro.color)
 
-  ; FIXME: introduces unused variables when using other themes
-  (setv! background :dark)
-  (setv! gruvbox_material_background :hard)
-  (setv! gruvbox_material_sign_column_background :none)
-  (setv! gruvbox_material_menu_selection_background :aqua)
   (vim.cmd (.. "colorscheme " colorscheme))
 
   ; Statusline
-  (highlight! :StatusLine {:fg (. colors :fg) :bg (. colors :bar)})
-  (highlight! :StatusLineNC {:fg (. colors :grey) :bg (. colors :black) :underline true})
-  (highlight! :StatusLinePad {:fg (. colors :skyblue) :bg (. colors :bar)})
-  (highlight! :StatusLineAccent {:fg (. colors :green) :bg (. colors :bar)})
-  (highlight! :StatusLineInsertAccent {:fg (. colors :red) :bg (. colors :bar)})
-  (highlight! :StatusLineVisualAccent {:fg (. colors :yellow) :bg (. colors :bar)})
-  (highlight! :StatusLineReplaceAccent {:fg (. colors :violet) :bg (. colors :bar)})
-  (highlight! :StatusLineCmdLineAccent {:fg (. colors :green) :bg (. colors :bar)})
-  (highlight! :StatusLineTerminalAccent {:fg (. colors :skyblue) :bg (. colors :bar)})
-  (highlight! :StatusLineFile {:fg (. colors :orange) :bg (. colors :bar) :bold true})
-  (highlight! :StatusLineFileData {:fg (. colors :violet) :bg (. colors :bar) :bold true})
-
-  ; Buffer
-  (highlight! :EndOfBuffer {:fg (. colors :bar)})
-  (highlight! :FloatBorder {:fg (. colors :blue)})
-  (highlight! :NormalFloat {:bg (. colors :bblack)})
-
-  ; Pmenu
-  (highlight! :Pmenu {:bg (. colors :bblack)})
-  (highlight! :PmenuSbar {:bg (. colors :bblack)})
-  (highlight! :PmenuSel {:fg (. colors :orange) :bg (. colors :dgrey)})
-  (highlight! :PmenuThumb {:bg (. colors :skyblue)})
-  (highlight! :CmpItemAbbr {:fg (. colors :fg)})
-  (highlight! :CmpItemAbbrMatch {:fg (. colors :fg)})
-  (highlight! :CmpItemKind {:fg (. colors :fg)})
-  (highlight! :CmpItemMenu {:fg (. colors :fg)})
+  (highlight! :StatusLineNC {:fg (. colors :graphite) :bg (. colors :bg) :underline true})
+  (highlight! :StatusLineAccent {:fg (. colors :accent) :bg (. colors :light_bg)})
+  (highlight! :StatusLineAccentBold {:fg (. colors :accent) :bg (. colors :light_bg) :bold true})
 
   ; LSP
-  (highlight! :DiagnosticError {:fg (. colors :red)})
-  (highlight! :DiagnosticWarn {:fg (. colors :yellow)})
-  (highlight! :DiagnosticInfo {:fg (. colors :green)})
-  (highlight! :DiagnosticHint {:fg (. colors :grey)})
-  (highlight! :DiagnosticSignError {:fg (. colors :red) :bg (. colors :bar)})
-  (highlight! :DiagnosticSignWarn {:fg (. colors :yellow) :bg (. colors :bar)})
-  (highlight! :DiagnosticSignInfo {:fg (. colors :green) :bg (. colors :bar)})
-  (highlight! :DiagnosticSignHint {:fg (. colors :grey) :bg (. colors :bar)})
-  (highlight! :LspReferenceRead {:underline true})
-  (highlight! :LspReferenceText {:underline true})
-  (highlight! :LspReferenceWrite {:underline true})
-  (highlight! :LspSemantic_variable {:bg :gray})
-  (link! :LspSemantic_type :Include)
-  (link! :LspSemantic_function :Identifier)
-  (link! :LspSemantic_struct :Number)
-  (link! :LspSemantic_keyword :Structure)
-
-  ; Lir
-  (highlight! :LirFloatNormal {:bg (. colors :black)})
-  (highlight! :LirDir {:fg (. colors :skyblue)})
-  (highlight! :LirSymLink {:fg (. colors :grey)})
-  (highlight! :LirEmptyDirText {:fg (. colors :blue)})
-  (highlight! :LirFloatCurdirWindowNormal {:bg (. colors :black)})
-  (highlight! :LirFloatCurdirWindowDirName {:fg (. colors :skyblue)})
-
-  ; Misc
-  (highlight! :TabLine {:fg (. colors :fg) :bg (. colors :mgrey)})
-  (highlight! :TabLineFill {:fg (. colors :fg) :bg (. colors :bar)})
-  (highlight! :TabLineSel {:fg (. colors :fg) :bg (. colors :dgrey)})
-  (highlight! :LineNr {:fg (. colors :grey)})
-  (highlight! :NvimInternalError {:fg (. colors :red)})
-  (highlight! :VertSplit {:fg (. colors :grey2)}))
+  (highlight! :DiagnosticSignError {:fg (. colors :red) :bg (. colors :light_bg)})
+  (highlight! :DiagnosticSignWarn {:fg (. colors :yellow) :bg (. colors :light_bg)})
+  (highlight! :DiagnosticSignInfo {:fg (. colors :green) :bg (. colors :light_bg)})
+  (highlight! :DiagnosticSignHint {:fg (. colors :graphite) :bg (. colors :light_bg)}))
 
 colors
diff --git a/fnl/nvrc/macro/color.fnl b/fnl/nvrc/macro/color.fnl
index d481fc9..70e23ee 100644
--- a/fnl/nvrc/macro/color.fnl
+++ b/fnl/nvrc/macro/color.fnl
@@ -5,8 +5,5 @@
   "Add a highlighting group."
   `(vim.api.nvim_set_hl 0 ,group ,colset))
 
-(fn link! [group link]
-  "Link a highlighting group."
-  (highlight! group {:link link}))
 
-{: highlight! : link!}
+{: highlight!}
diff --git a/fnl/nvrc/pack.fnl b/fnl/nvrc/pack.fnl
index a5be0d4..04d9e13 100644
--- a/fnl/nvrc/pack.fnl
+++ b/fnl/nvrc/pack.fnl
@@ -4,10 +4,9 @@
 (pack! :rktjmp/hotpot.nvim)
 (pack! :lewis6991/impatient.nvim)
 
-(pack! :sainnhe/gruvbox-material {:config "require('nvrc.colors').apply('gruvbox-material')"})
+(pack! "~/projects/dots/avalanche" {:config "require('nvrc.colors').apply('avalanche')"})
 (pack! :nvim-treesitter/nvim-treesitter {:req :treesitter
-                                         :requires [(pack :p00f/nvim-ts-rainbow {:after :nvim-treesitter})
-                                                    (pack :nvim-treesitter/nvim-treesitter-refactor {:after :nvim-treesitter})
+                                         :requires [(pack :nvim-treesitter/nvim-treesitter-refactor {:after :nvim-treesitter})
                                                     (pack :nvim-treesitter/nvim-treesitter-textobjects {:after :nvim-treesitter})]})
 
 (pack! :Pocco81/TrueZen.nvim {:cmd :TZAtaraxis})
diff --git a/fnl/nvrc/packs/treesitter.fnl b/fnl/nvrc/packs/treesitter.fnl
index c3b6f17..84ce9da 100644
--- a/fnl/nvrc/packs/treesitter.fnl
+++ b/fnl/nvrc/packs/treesitter.fnl
@@ -4,10 +4,6 @@
 
 (setup {:ensure_installed [:fennel :lua :nix]
         :highlight {:enable true :use_languagetree true}
-        :rainbow {:enable true
-                  :extended_mode true
-                  :max_file_lines 2000
-                  :disable [:c :cpp]}
         :incremental_selection {:enable true
                                 :keymaps {:init_selection :gnn
                                           :node_incremental :grn
diff --git a/fnl/nvrc/ui/modules/misc.fnl b/fnl/nvrc/ui/modules/misc.fnl
deleted file mode 100644
index 24d84f9..0000000
--- a/fnl/nvrc/ui/modules/misc.fnl
+++ /dev/null
@@ -1,14 +0,0 @@
-(fn file-size []
-  "feline.nvim's file size calculation module."
-  (let [suffix [:b :k :M :G :T :P :E]]
-    (var index 1)
-    (var fsize (vim.fn.getfsize (vim.api.nvim_buf_get_name 0)))
-    (when (< fsize 0)
-      (set fsize 0))
-    (while (and (> fsize 1024) (< index 7))
-      (set fsize (/ fsize 1024))
-      (set index (+ index 1)))
-    (string.format (or (and (= index 1) "%g%s | ") "%.2f%s | ") fsize
-                   (. suffix index))))
-
-{: file-size}
diff --git a/fnl/nvrc/ui/modules/vi_mode.fnl b/fnl/nvrc/ui/modules/vi_mode.fnl
deleted file mode 100644
index 0fd4e16..0000000
--- a/fnl/nvrc/ui/modules/vi_mode.fnl
+++ /dev/null
@@ -1,40 +0,0 @@
-(local modes {:n :NORMAL
-              :no :NORMAL
-              :v :VISUAL
-              :V "V-LINE"
-              "\022" "V-BLOCK"
-              :s :SELECT
-              :S "L-SELECT"
-              "\019" "B-SELECT"
-              :i :INSERT
-              :ic :INSERT
-              :R :REPLACE
-              :Rv "V-REPLACE"
-              :c :COMMAND
-              :cv "VIM-EX"
-              :ce :EX
-              :r :PROMPT
-              :rm :MOAR
-              :r? :CONFIRM
-              :! :SHELL
-              :t :TERMINAL})
-
-(fn mode []
-  (let [current-mode (. (vim.api.nvim_get_mode) :mode)]
-    (: (string.format "%s " (. modes current-mode)) :upper)))
-
-(fn update-mode-colors []
-  (let [current-mode (. (vim.api.nvim_get_mode) :mode)]
-    (var mode-color "%#StatusLineAccent#")
-    (if (= current-mode :n) (set mode-color "%#StatusLineAccent#")
-        (or (= current-mode :i) (= current-mode :ic))
-        (set mode-color "%#StatusLineInsertAccent#")
-        (or (or (= current-mode :v) (= current-mode :V))
-            (= current-mode "\022"))
-        (set mode-color "%#StatusLineVisualAccent#") (= current-mode :R)
-        (set mode-color "%#StatusLineReplaceAccent#") (= current-mode :c)
-        (set mode-color "%#StatusLineCmdLineAccent#") (= current-mode :t)
-        (set mode-color "%#StatusLineTerminalAccent#"))
-    mode-color))
-
-{: mode : update-mode-colors}
diff --git a/fnl/nvrc/ui/statusline.fnl b/fnl/nvrc/ui/statusline.fnl
index 9c6d04c..c50bc81 100644
--- a/fnl/nvrc/ui/statusline.fnl
+++ b/fnl/nvrc/ui/statusline.fnl
@@ -2,25 +2,20 @@
 (import-macros {: ag!
                 : au!} :nvrc.macro.event)
 
-(local {: mode : update-mode-colors} (require :nvrc.ui.modules.vi_mode))
 (local {: diagnostics} (require :nvrc.ui.modules.diagnostics))
-(local {: file-size} (require :nvrc.ui.modules.misc))
 
 (global statusline {})
 (set statusline.enable (fn []
-                         (table.concat ["%#StatusLinePad#"
+                         (table.concat ["%#StatusLineAccent#"
                                         "▊ "
                                         "%#StatusLine#"
-                                        (update-mode-colors)
-                                        (mode)
-                                        "%#StatusLineFile#"
+                                        "%#StatusLineAccentBold#"
                                         "%f%m%r "
                                         "%#StatusLine#"
-                                        (file-size)
                                         "%l:%c | "
                                         (diagnostics)
                                         "%="
-                                        "%#StatusLineFileData#"
+                                        "%#StatusLineAccentBold#"
                                         "%y *%n "])))
 
 (ag! ui-statusline