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.splitbelow true)
(set o.splitright true) (set o.splitright true)
;; Diff ;; Diff
(set o.diffopt [:filler :internal "algorithm:histogram" :indent-heuristic]) (set o.diffopt [:internal
:filler
"algorithm:histogram"
:indent-heuristic
"linematch:50"])
;; UI ;; UI
(set o.number true) (set o.number true)
(set o.relativenumber true) (set o.relativenumber true)

View file

@ -42,7 +42,8 @@
(keymap.set :n :<leader>vb (keymap.set :n :<leader>vb
#(telescope-builtin.git_branches telescope-dropdown) #(telescope-builtin.git_branches telescope-dropdown)
{:desc "List VCS Branches"}) {: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) (keymap.set :n :<leader>vc #(repl.toggle-specific-shell :vcs)
{:desc "Toggle VCS Shell"}) {:desc "Toggle VCS Shell"})
(keymap.set :n :<leader>lk telescope-builtin.keymaps (keymap.set :n :<leader>lk telescope-builtin.keymaps

View file

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

View file

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