summaryrefslogtreecommitdiff
path: root/fnl
diff options
context:
space:
mode:
authorMike Vink <>2023-04-02 12:47:59 +0200
committerMike Vink <>2023-04-02 12:47:59 +0200
commitebdf3ec8a5bc0cc964577a19e8789bc019e72cff (patch)
tree043a7b8a7d5ed9a49c5c69acd163f42cf5a71aa4 /fnl
parente4602c57b81f9baf73f9c9be226bb0ba03db3d90 (diff)
broken but will fix later
Diffstat (limited to 'fnl')
-rw-r--r--fnl/conf/pkgs.fnl2
-rw-r--r--fnl/conf/pkgs/harpoon.fnl10
-rw-r--r--fnl/conf/pkgs/heirline.fnl63
-rw-r--r--fnl/conf/pkgs/tree-sitter-context.fnl2
4 files changed, 75 insertions, 2 deletions
diff --git a/fnl/conf/pkgs.fnl b/fnl/conf/pkgs.fnl
index 3ffb15f..af5ee71 100644
--- a/fnl/conf/pkgs.fnl
+++ b/fnl/conf/pkgs.fnl
@@ -3,6 +3,7 @@
(require :conf.pkgs.null-ls)
(require :conf.pkgs.lspconfig)
(require :conf.pkgs.treesitter)
+(require :conf.pkgs.tree-sitter-context)
(require :conf.pkgs.conjure)
(require :conf.pkgs.test)
(require :conf.pkgs.trouble)
@@ -11,3 +12,4 @@
(require :conf.pkgs.dap)
(require :conf.pkgs.heirline)
(require :conf.pkgs.gitsigns)
+(require :conf.pkgs.harpoon)
diff --git a/fnl/conf/pkgs/harpoon.fnl b/fnl/conf/pkgs/harpoon.fnl
new file mode 100644
index 0000000..00d1367
--- /dev/null
+++ b/fnl/conf/pkgs/harpoon.fnl
@@ -0,0 +1,10 @@
+(local harpoon-mark (require :harpoon.mark))
+(local harpoon-ui (require :harpoon.ui))
+(vim.keymap.set :n "[]" (lambda [] (harpoon-mark.add_file)))
+(vim.keymap.set :n "]]" (lambda [] (harpoon-ui.nav_next)))
+(vim.keymap.set :n "[[" (lambda [] (harpoon-ui.nav_prev)))
+(vim.keymap.set :n "[1" (lambda [] (harpoon-ui.nav_file 1)))
+(vim.keymap.set :n "[2" (lambda [] (harpoon-ui.nav_prev 2)))
+(vim.keymap.set :n "[3" (lambda [] (harpoon-ui.nav_prev 3)))
+(vim.keymap.set :n "[4" (lambda [] (harpoon-ui.nav_prev 4)))
+(vim.keymap.set :n "[5" (lambda [] (harpoon-ui.nav_prev 5)))
diff --git a/fnl/conf/pkgs/heirline.fnl b/fnl/conf/pkgs/heirline.fnl
index e990ba4..27b2b1b 100644
--- a/fnl/conf/pkgs/heirline.fnl
+++ b/fnl/conf/pkgs/heirline.fnl
@@ -4,6 +4,9 @@
(local colors (let [kanagawa-colors (require :kanagawa.colors)]
(kanagawa-colors.setup)))
+(local Align {:provider "%="})
+(local Space {:provider " "})
+
(heirline.load_colors colors)
(fn palette [name]
(. (. colors :palette) name))
@@ -55,6 +58,62 @@
(.. " " (dap.status)))
:hl :Debug})
-(local Statusline [FileNameBlock DAPMessages])
+(local Ruler {;; %l = current line number
+ ;; %L = number of lines in the buffer
+ ;; %c = column number
+ ;; %P = percentage through file of displayed window
+ :provider "%7(%l/%3L%):%2c %P"})
+
+(local ScrollBar
+ {:static {:sbar ["▁" "▂" "▃" "▄" "▅" "▆" "▇" "█"]}
+ ;; Another variant, because the more choice the better.
+ ;; sbar { '🭶', '🭷', '🭸', '🭹', '🭺', '🭻'}}
+ :provider (lambda [self]
+ (local curr_line (. (vim.api.nvim_win_get_cursor 0) 1))
+ (local lines (vim.api.nvim_buf_line_count 0))
+ (local i (+ (math.floor (* (/ (- curr_line 1) lines)
+ (length (. self :sbar))))
+ 1))
+ (string.rep (. self :sbar i) 2))
+ :hl {:fg (theme :syn :fun) :bg (theme :ui :bg)}})
+
+(local StatusLine [FileNameBlock
+ Space
+ DAPMessages
+ Align
+ Ruler
+ Space
+ ScrollBar
+ Space])
+
+(local harpoon-mark (require :harpoon.mark))
+(local Tabpage
+ {:provider (lambda [self]
+ (fn fnamemod [name mod]
+ (vim.fn.fnamemodify name mod))
+
+ (fn format-name [name]
+ (if (= name "") "[No Name]"
+ (fnamemod name ":.:t")))
+
+ (local harpoon_marks
+ (accumulate
+ (icollect [_ win (ipairs (vim.api.nvim_tabpage_list_wins self.tabpage))]
+ (vim.api.nvim_win_get_buf win))))
+ (print (vim.inspect harpoon_marks))
+ (.. "%" self.tabnr "T " self.tabnr " " " %T"))
+ :hl (lambda [self]
+ (if (not (. self :is_active)) :TabLine :TabLineSel))})
+
+(local TabpageClose {:provider "%999X  %X" :hl :TabLine})
+
+(local TabPages
+ {;; only show this component if there's 2 or more tabpages
+ :condition (lambda []
+ (>= (length (vim.api.nvim_list_tabpages)) 2))})
+
+(local TabPages
+ (utils.insert TabPages {:provider "%="} (utils.make_tablist Tabpage)
+ TabpageClose))
-(heirline.setup {:statusline Statusline})
+(heirline.setup {:statusline StatusLine :tabline [TabPages]})
diff --git a/fnl/conf/pkgs/tree-sitter-context.fnl b/fnl/conf/pkgs/tree-sitter-context.fnl
new file mode 100644
index 0000000..12fedc6
--- /dev/null
+++ b/fnl/conf/pkgs/tree-sitter-context.fnl
@@ -0,0 +1,2 @@
+(local context (require :treesitter-context))
+(context.setup {:enable true})