1
0
Fork 0

nvim: Update configuration

This commit is contained in:
Daniel Kempkens 2023-01-14 17:07:11 +01:00
parent e0a4aee062
commit 6538a931e1
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
4 changed files with 50 additions and 19 deletions

View file

@ -38,7 +38,11 @@
(set o.splitbelow true)
(set o.splitright true)
;; Diff
(set o.diffopt [:filler :internal "algorithm:histogram" :indent-heuristic])
(set o.diffopt [:internal
:filler
"algorithm:histogram"
:indent-heuristic
"linematch:50"])
;; UI
(set o.number true)
(set o.relativenumber true)

View file

@ -42,7 +42,8 @@
(keymap.set :n :<leader>vb
#(telescope-builtin.git_branches telescope-dropdown)
{:desc "List VCS Branches"})
(keymap.set :n :<leader>vl gitsigns.blame_line {:desc "Blame Line"})
(keymap.set :n :<leader>vl #(gitsigns.blame_line {:full true})
{:desc "Blame Line"})
(keymap.set :n :<leader>vc #(repl.toggle-specific-shell :vcs)
{:desc "Toggle VCS Shell"})
(keymap.set :n :<leader>lk telescope-builtin.keymaps

View file

@ -1,7 +1,8 @@
(let [mod {}
api vim.api
o vim.opt
statusline (require :nifoc.statusline)]
statusline (require :nifoc.statusline)
gitsigns (require :gitsigns)]
;; Line Number
(set mod.line-number
{:condition #(or (o.number:get) (o.relativenumber:get))
@ -27,21 +28,31 @@
1 :signs 1)]
(set self.sign sign)
(set self.has_sign (not= sign nil))))
:provider " │"
:hl #(if $1.has_sign $1.sign.name :StatusLineNC)})
(set mod.gitsigns-or-bar [{:condition #(or (o.number:get)
(o.relativenumber:get))
:provider #(if (= vim.b.nifoc_gitsigns_enabled 1)
"" " │")
:provider " ▏"
:hl #(if $1.has_sign $1.sign.name :StatusLineNC)
:on_click {:name :heirline_statuscolumn_gitsigns
:callback (fn [self]
(let [mouse (vim.fn.getmousepos)
cursor-pos [mouse.line 0]]
(api.nvim_win_set_cursor mouse.winid
cursor-pos)
(vim.defer_fn #(gitsigns.blame_line {:full true})
100)))}})
(set mod.gitsigns-or-bar [{:condition #(and (not= vim.b.nifoc_gitsigns_enabled
1)
(or (o.number:get)
(o.relativenumber:get)))
:provider " ▏"
:hl :StatusLineNC}
mod.gitsigns])
;; Diagnostic signs
(set mod.diagnostic-signs
{:condition #(= vim.b.nifoc_diagnostics_enabled 1)
:static {:sign-text {:DiagnosticSignError " "
:DiagnosticSignWarn " "
{:condition #(and (= vim.b.nifoc_diagnostics_enabled 1)
(> (length (vim.diagnostic.get 0)) 0))
:static {:sign-text {:DiagnosticSignError " "
:DiagnosticSignWarn " "
:DiagnosticSignInfo " "
:DiagnosticSignHint " "}}
:DiagnosticSignHint " "}}
:init (fn [self]
(let [bufnr (api.nvim_get_current_buf)
lnum vim.v.lnum
@ -67,11 +78,9 @@
cursor-pos [mouse.line 0]]
(api.nvim_win_set_cursor mouse.winid
cursor-pos)
(vim.schedule #(vim.diagnostic.goto_next {:win_id mouse.winid
:float false}))
(vim.defer_fn #(vim.diagnostic.open_float {:bufnr self.bufnr
:pos line
:scope :line})
200)))}})
100)))}})
mod)

View file

@ -1,11 +1,28 @@
(let [indent (require :indent_blankline)]
(indent.setup {:char "¦"
(indent.setup {:char ""
:show_first_indent_level false
:use_treesitter true
:show_current_context true
:context_char "│"
:context_patterns [:class
:function
:^func
:method
:^if
:while
:for
:with
:try
:except
:arguments
:argument_list
:object
:dictionary
:element
:list
:table
:sequential_table
:tuple
:do_block
:stab_clause]
:buftype_exclude [:help :nofile :terminal]}))
:buftype_exclude [:help :nofile :prompt :quickfix :terminal]}))