summaryrefslogtreecommitdiff
path: root/fnl/plugins/editor/gitsigns.fnl
blob: 8150f9889ba4b3e62a53b0b2710acb3f22021a61 (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
;; Add git signs to source files.

(local keys [{1 :<leader>gR
              2 "<cmd>lua require 'gitsigns'.reset_buffer()<cr>"
              :mode :n
              :desc "Reset Buffer"}
             {1 :<leader>gd
              2 "<cmd>Gitsigns diffthis HEAD<cr>"
              :mode :n
              :desc :Diff}
             {1 :<leader>gj
              2 "<cmd>lua require 'gitsigns'.next_hunk()<cr>"
              :mode :n
              :desc "Next Hunk"}
             {1 :<leader>gk
              2 "<cmd>lua require 'gitsigns'.prev_hunk()<cr>"
              :mode :n
              :desc "Prev Hunk"}
             {1 :<leader>gl
              2 "<cmd>lua require 'gitsigns'.blame_line()<cr>"
              :mode :n
              :desc :Blame}
             {1 :<leader>gp
              2 "<cmd>lua require 'gitsigns'.preview_hunk()<cr>"
              :mode :n
              :desc "Preview Hunk"}
             {1 :<leader>gr
              2 "<cmd>lua require 'gitsigns'.reset_hunk()<cr>"
              :mode :n
              :desc "Reset Hunk"}
             {1 :<leader>gs
              2 "<cmd>lua require 'gitsigns'.stage_hunk()<cr>"
              :mode :n
              :desc "Stage Hunk"}
             {1 :<leader>gu
              2 "<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>"
              :mode :n
              :desc "Undo Stage Hunk"}
             {1 :<leader>gn
              2 ":<C-U>Gitsigns select_hunk<CR>"
              :mode [:o :x]
              :desc "GitSigns Select Hunk"}])

(local icons (require :plugins.icons))

(local signs {:add {:text (. icons :git-add)}
              :change {:text (. icons :git-add)}
              :delete {:text (. icons :git-delete)}
              :topdelete {:text (. icons :git-top-delete)}
              :changedelete {:text (. icons :git-change-delete)}
              :untracked {:text (. icons :git-untracked)}})

(local opts {: signs
             :signcolumn true
             :numhl false
             :linehl false
             :word_diff false
             :watch_gitdir {:follow_files true}
             :attach_to_untracked true
             :current_line_blame false
             :current_line_blame_opts {:virt_text true
                                       :virt_text_pos :eol
                                       :delay 1000
                                       :ignore_whitespace false}
             :current_line_blame_formatter "<author>, <author_time:%Y-%m-%d> - <summary>"
             :sign_priority 6
             :update_debounce 100
             :status_formatter nil
             :max_file_length 40000
             :preview_config {:border :single
                              :style :minimal
                              :relative :cursor
                              :row 0
                              :col 1}
             :yadm {:enable false}})

{1 :lewis6991/gitsigns.nvim :event [:BufReadPre :BufNewFile] : opts : keys}