1
0
Fork 0

nvim: Use new statuscolumn

This commit is contained in:
Daniel Kempkens 2023-01-11 22:45:22 +01:00
parent c89b4460f2
commit 68b7947137
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
10 changed files with 141 additions and 85 deletions

View file

@ -140,11 +140,11 @@
},
"locked": {
"dir": "contrib",
"lastModified": 1673321445,
"narHash": "sha256-5jdmIgcN2PNWHozyj8WRoSVJBiQi61SqWGfTJXUBDOI=",
"lastModified": 1673401931,
"narHash": "sha256-wt0AcvtyWSyk6HxANH3iO0ztzzAO0jxHkF6tk2nY1jg=",
"owner": "neovim",
"repo": "neovim",
"rev": "1df2db0bc4dfa2e4f632f9b3dbae00b8b29f2d9f",
"rev": "93d99aefd314bc4abfc54c0c29a4de84b6fcc823",
"type": "github"
},
"original": {
@ -161,11 +161,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1673338492,
"narHash": "sha256-UbqugOENjdtTWCvJQQ0ym80zTB28esvJQPO3j3+Zmjw=",
"lastModified": 1673424920,
"narHash": "sha256-obfKkavXH9CWLTJaJ8bPJ6AZdbE24+cIeBbQjzuSHv0=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "de5bef64b8158b85b47256d5a366973534130621",
"rev": "15813daffca93531243cf00ba57963e8d3df4129",
"type": "github"
},
"original": {
@ -181,11 +181,11 @@
]
},
"locked": {
"lastModified": 1673252722,
"narHash": "sha256-7xMX6occigxsvx4gcS2Pp2cQhkVYc9Ob5Bdvq6q1Svw=",
"lastModified": 1673425540,
"narHash": "sha256-hVcebzRpFHB3lu717sDVUvr6ZtvfQOJh7GdduhK1Kvs=",
"owner": "nifoc",
"repo": "nix-overlay",
"rev": "66ac2c0acf54e096350cd06a2173e3118b8d51a7",
"rev": "e1f1f635b6986a7192a78d83ba7bfdce8ef43e49",
"type": "github"
},
"original": {
@ -212,11 +212,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1673301451,
"narHash": "sha256-0IvOqAXZ+dHjOV7dQl4iEcCUmzqg8VvGg+UZ68ONDIg=",
"lastModified": 1673363027,
"narHash": "sha256-nuPLEsEUvERI+gwmqknerUVHhdzDiZHKZ18Ibkvo7VQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "35f1f865c03671a4f75a6996000f03ac3dc3e472",
"rev": "d3b4150929d4fed7eb626695c4f78881cfcbeb9e",
"type": "github"
},
"original": {

View file

@ -17,8 +17,7 @@
:extends "→"})
(set o.showbreak "↪ ")
(set o.backspace [:indent :eol :start])
(set o.showtabline 2)
(set o.signcolumn "yes:1")
(set o.signcolumn :no)
(set o.completeopt [:menu :menuone :noselect])
(set o.startofline false)
(set o.synmaxcol 300)

View file

@ -11,15 +11,14 @@
(fn mod.setup []
(vim.diagnostic.config {:underline true
:virtual_text false
:virtual_lines true
:signs true
:float {:border :rounded :source true}
:update_in_insert false
:severity_sort true})
(sign "define DiagnosticSignError text= texthl=DiagnosticSignError linehl= numhl=DiagnosticSignError")
(sign "define DiagnosticSignWarn text= texthl=DiagnosticSignWarn linehl= numhl=DiagnosticSignWarn")
(sign "define DiagnosticSignInfo text= texthl=DiagnosticSignInfo linehl= numhl=DiagnosticSignInfo")
(sign "define DiagnosticSignHint text= texthl=DiagnosticSignHint linehl= numhl=DiagnosticSignHint"))
(sign "define DiagnosticSignError text= texthl=DiagnosticSignError linehl= numhl=")
(sign "define DiagnosticSignWarn text= texthl=DiagnosticSignWarn linehl= numhl=")
(sign "define DiagnosticSignInfo text= texthl=DiagnosticSignInfo linehl= numhl=")
(sign "define DiagnosticSignHint text= texthl=DiagnosticSignHint linehl= numhl="))
(fn mod.maybe-enable-diagnostics [bufnr]
(when (= vim.b.nifoc_diagnostics_enabled nil)

View file

@ -10,7 +10,6 @@
noice (require :noice)
npairs (require :nvim-autopairs)
gitsigns (require :gitsigns)
lsp-lines (require :lsp_lines)
repl (require :nifoc.repl)
formatting (require :nifoc.formatting)]
(fn mod.setup []
@ -52,7 +51,6 @@
{:desc "Show Diagnostics"})
(keymap.set :n :<leader>dli :<cmd>LspInfo<CR> {:desc "LSP Info"})
(keymap.set :n :<leader>dlr :<cmd>LspRestart<CR> {:desc "Restart LSP"})
(keymap.set :n :<leader>dt #(lsp-lines.toggle) {:desc "Toggle Diagnostics"})
(keymap.set :n :<leader>dtp :<cmd>TSPlaygroundToggle<CR>
{:desc "Toggle Treetsitter Playground"})
(keymap.set :n :<leader>dn #(noice.cmd :telescope)

View file

@ -0,0 +1,71 @@
(let [mod {}
api vim.api
o vim.opt
statusline (require :nifoc.statusline)]
;; Line Number
(set mod.line-number
{:condition #(or (o.number:get) (o.relativenumber:get))
1 statusline.push-right
2 {:provider (fn []
(let [num (o.number:get)
relnum (o.relativenumber:get)]
(if (and num (not relnum)) "%l"
(and relnum (not num)) "%r"
"%{v:relnum?v:relnum:v:lnum}")))}})
;; Signs
(set mod.signs {:provider "%s" :hl {:bold true}})
;; gitsigns
(set mod.gitsigns {:condition #(= vim.b.nifoc_gitsigns_enabled 1)
:init (fn [self]
(let [bufnr (api.nvim_get_current_buf)
lnum vim.v.lnum
sign (?. (vim.fn.sign_getplaced bufnr
{:group :gitsigns_vimfn_signs_
:id lnum
: lnum})
1 :signs 1)]
(set self.sign sign)
(set self.has_sign (not= sign nil))))
:provider #(if $1.has_sign " ▎" " ")
:hl #(when $1.has_sign
$1.sign.name)})
(set mod.gitsigns-or-space [{:condition #(or (o.number:get)
(o.relativenumber:get))
:provider #(if (= vim.b.nifoc_gitsigns_enabled 1)
"" " ")}
mod.gitsigns])
;; Diagnostic signs
(set mod.diagnostic-signs
{:condition #(= vim.b.nifoc_diagnostics_enabled 1)
:static {:sign-text {:DiagnosticSignError " "
:DiagnosticSignWarn " "
:DiagnosticSignInfo " "
:DiagnosticSignHint " "}}
:init (fn [self]
(let [bufnr (api.nvim_get_current_buf)
lnum vim.v.lnum
signs (?. (vim.fn.sign_getplaced bufnr
{:group "*" : lnum})
1 :signs)
diagnostic-signs (vim.tbl_filter #(vim.startswith $1.group
:vim.diagnostic)
signs)
sign (?. diagnostic-signs 1)]
(set self.bufnr bufnr)
(set self.sign sign)
(set self.has_sign (not= sign nil))))
:provider #(if $1.has_sign
(. $1.sign-text $1.sign.name)
" ")
:hl #(when $1.has_sign
$1.sign.name)
:on_click {:name :heirline_statuscolumn_diagnostic
:callback (fn [self]
(let [mouse (vim.fn.getmousepos)]
(vim.schedule #(vim.diagnostic.open_float {:bufnr self.bufnr
:pos (- mouse.line
1)
:scope :line
:focusable false}))))}})
mod)

View file

@ -1,4 +1,5 @@
(let [gitsigns (require :gitsigns)]
(let [gitsigns (require :gitsigns)
set-bufvar vim.api.nvim_buf_set_var]
(gitsigns.setup {:signs {:add {:hl :GitSignsAdd
:text "│"
:numhl :GitSignsAddNr
@ -18,9 +19,15 @@
:changedelete {:hl :GitSignsChange
:text "~"
:numhl :GitSignsChangeNr
:linehl :GitSignsChangeLn}}
:linehl :GitSignsChangeLn}
:untracked {:hl :GitSignsUntracked
:text "┆"
:numhl :GitSignsUntrackedNr
:linehl :GitSignsUntrackedLn}}
:numhl false
:linehl false
:diff_opts {:internal true}
:preview_config {:border :rounded}}))
:preview_config {:border :rounded}
:on_attach (fn [bufnr]
(set-bufvar bufnr :nifoc_gitsigns_enabled 1))}))

View file

@ -2,7 +2,8 @@
utils (require :heirline.utils)
conditions (require :heirline.conditions)
ns (require :nifoc.statusline)
nt (require :nifoc.tabline)]
nt (require :nifoc.tabline)
nc (require :nifoc.statuscolumn)]
(local default-statusline [;; Left
ns.vi-mode
ns.git
@ -23,24 +24,25 @@
(conditions.buffer_matches {:filetype [:TelescopePrompt]}))
1 (ns.custom-mode :Telescope :black :green)})
(local shell-statusline
{:condition (fn []
(not= vim.b.nifoc_shell_mode nil))
{:condition #(not= vim.b.nifoc_shell_mode nil)
1 ns.vi-mode
2 ns.push-right
3 ns.scrollbar
4 ns.space
5 (ns.shell-mode :black :purple)})
(local statuslines {:hl ns.default-hl
:fallthrough false
1 telescope-statusline
2 shell-statusline
3 default-statusline})
(local statusline {:hl ns.default-hl
:fallthrough false
1 telescope-statusline
2 shell-statusline
3 default-statusline})
(local winbar nil)
(local tabline [nt.os-indicator
(utils.make_buflist nt.buffer-block nt.truncate-left
nt.truncate-right)
nt.tabpages-block])
(local statuscolumn [nc.diagnostic-signs nc.line-number nc.gitsigns-or-space])
;; Load Lines
(set vim.opt.laststatus 3)
(heirline.setup statuslines winbar tabline))
(set vim.opt.showtabline 2)
(heirline.setup {: statusline : winbar : tabline : statuscolumn}))

View file

@ -183,15 +183,6 @@ in
nvim-jdtls
{
plugin = lsp_lines-nvim;
config = ''
(let [lsp-lines (require :lsp_lines)]
(lsp-lines.setup))
'';
type = "fennel";
}
lspkind-nvim
{

View file

@ -25,12 +25,12 @@ rec {
};
plenary-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "plenary.nvim";
version = "2023-01-06";
version = "2023-01-10";
src = pkgs.fetchFromGitHub {
owner = "nvim-lua";
repo = "plenary.nvim";
rev = "9d81624fbcedd3dd43b38d7e13a1e7b3f873d8cd";
sha256 = "0y3qn0rwlwp720517lwg35f09b30b591hprbvb6hgvn1waw2ljzc";
rev = "1c7e3e6b0f4dd5a174fcea9fda8a4d7de593b826";
sha256 = "12hp9a2q80hg93ynfa97v03fmxqwv4d6f1yb92bi6ih3kbjyjsji";
fetchSubmodules = false;
};
};
@ -112,23 +112,23 @@ rec {
};
};
nvim-treesitter = pkgs.vimPlugins.nvim-treesitter.overrideAttrs (_: {
version = "2023-01-10";
version = "2023-01-11";
src = pkgs.fetchFromGitHub {
owner = "nvim-treesitter";
repo = "nvim-treesitter";
rev = "5b1299868302184f2e15819a719df698ad1aa251";
sha256 = "13s769njjzqwyzr8v6k9i46vhsmsx8wp4k3fqvyac7zbpqv2xkq6";
rev = "1298d9ba3ba78cf6bba3810e47e5d2d568f33614";
sha256 = "1yfx0rkypan9fnpsq0q9fzvll17hvy7akbzmgbkacqp39chi11ym";
fetchSubmodules = false;
};
});
nvim-ts-rainbow = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-ts-rainbow";
version = "2023-01-02";
version = "2023-01-09";
src = pkgs.fetchFromGitHub {
owner = "p00f";
owner = "mrjones2014";
repo = "nvim-ts-rainbow";
rev = "ef95c15a935f97c65a80e48e12fe72d49aacf9b9";
sha256 = "0ldv8g9i25286n0xqa1cj7a2lglcz9564dawz6ixd4ipsysjj571";
rev = "aa83e4967bf78f85ffd9a11e159900c7ea7e423b";
sha256 = "09x3bq4j9398avmzix78gm1qam0m34r9ifz7rb6l5rcqw7lhvr5q";
fetchSubmodules = false;
};
};
@ -145,12 +145,12 @@ rec {
};
telescope-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "telescope.nvim";
version = "2023-01-07";
version = "2023-01-11";
src = pkgs.fetchFromGitHub {
owner = "nvim-telescope";
repo = "telescope.nvim";
rev = "04af51dbfb17c2afa0b8d82b0e842e0638201ca9";
sha256 = "16m9k42cy4kd5a067y7wnbzzqizms74837n9p5hqj3l1s429vr1v";
rev = "1ba7278cf08da8048e7f589ef6b65a39fd3e4dbf";
sha256 = "07msm2fjyqqx687809wci3k1birrwrjw26h5qv20f5wjbh2bxii5";
fetchSubmodules = false;
};
};
@ -225,12 +225,12 @@ rec {
};
nvim-lspconfig = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-lspconfig";
version = "2023-01-09";
version = "2023-01-11";
src = pkgs.fetchFromGitHub {
owner = "neovim";
repo = "nvim-lspconfig";
rev = "7b98aadc6e85db4fc3af6c1ec22c4774d965506e";
sha256 = "1b0ygz9jyaj0i993qnjvfnr6yxf65sa8vkfjg2qh2gh1dphsvhfp";
rev = "f0221821d8ceed70f0525a2c35380ba56672e107";
sha256 = "156rys98bv2kwhfrpwqda3pkhjl4lxbjfcm7kwhjxpsrnnyf7an3";
fetchSubmodules = false;
};
};
@ -245,17 +245,6 @@ rec {
fetchSubmodules = false;
};
};
lsp_lines-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "lsp_lines.nvim";
version = "2022-11-16";
src = pkgs.fetchFromSourcehut {
owner = "~whynothugo";
repo = "lsp_lines.nvim";
rev = "ec98b45c8280e5ef8c84028d4f38aa447276c002";
sha256 = "0xwbhznwbs6bshp1l501caymdcs486apn4rx4p9vnryrxdzc4chy";
fetchSubmodules = false;
};
};
lspkind-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "lspkind.nvim";
version = "2022-09-22";
@ -280,12 +269,12 @@ rec {
};
vim-illuminate = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "vim-illuminate";
version = "2022-11-11";
version = "2023-01-11";
src = pkgs.fetchFromGitHub {
owner = "RRethy";
repo = "vim-illuminate";
rev = "a6d0b28ea7d6b9d139374be1f94a16bd120fcda3";
sha256 = "0wby253z3njala4syizy3m463gi8l45gcf7rj866r2jhnfxg9ba8";
rev = "da80f3877896adcf77f59fb0bf74e9601615d372";
sha256 = "129r4jrdffy18yklk18gbplgxf7dkngda8cgssf9xfawizyg739v";
fetchSubmodules = false;
};
};
@ -445,12 +434,12 @@ rec {
};
neoformat = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "neoformat";
version = "2022-12-06";
version = "2023-01-11";
src = pkgs.fetchFromGitHub {
owner = "sbdchd";
repo = "neoformat";
rev = "902f674b9e8a703fad9dafdda9d8f7c88ecf689f";
sha256 = "12zxmyhk06xiyr5sahqip9pf6f5zyvr46yb6a4ayzdk81k8wmdky";
rev = "ec601d38a2e9309109f405ce038c5a6ce774f1a9";
sha256 = "028xycbvjhs7mvnzlismjipibgqdhjm9s0asmjpg3g7y2qhkw3ix";
fetchSubmodules = false;
};
};
@ -511,12 +500,12 @@ rec {
};
heirline-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "heirline.nvim";
version = "2022-12-10";
version = "2023-01-11";
src = pkgs.fetchFromGitHub {
owner = "rebelot";
repo = "heirline.nvim";
rev = "556666aabb57c227cbb14a996b30b2934e5ff7b1";
sha256 = "1i0yavl3sgczw488ibaakyjjmnl7239r7hi0fdjdm10xfp4cwn3m";
rev = "b07ae7e499fecc263f38d1db7feeb2da227df370";
sha256 = "01mrxxlbslbz8rxr9g0qbc0q5qcdk5gamvlfy07h6ba8c04bq2r6";
fetchSubmodules = false;
};
};
@ -566,12 +555,12 @@ rec {
};
gitsigns-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "gitsigns.nvim";
version = "2023-01-10";
version = "2023-01-11";
src = pkgs.fetchFromGitHub {
owner = "lewis6991";
repo = "gitsigns.nvim";
rev = "b57784ea7291aac0513c4b10d5bea6696d0316f2";
sha256 = "191rw56bmc9k25kfkmykq523fplq0lf9s6338wva12r1xbv622wr";
rev = "6c3a381c619f3201dfbc0ba4a02c85e24a442886";
sha256 = "0b8q10nnzdcbxbrqzfcbdzv2vngybdgb9065bp19lkglzr087zfq";
fetchSubmodules = false;
};
};
@ -603,8 +592,8 @@ rec {
src = pkgs.fetchFromGitHub {
owner = "folke";
repo = "noice.nvim";
rev = "567ad5b7cb0b96af89c6b7a8184284db48375aa3";
sha256 = "06kdj8psa9alyd6cswgj2r9sq4x9703xlhga2yprwkvv64asrm04";
rev = "2613a16b5009acbf2adabb34b029b1c4c57101e3";
sha256 = "01yx1pk7xliaadmrhrg83zm3rcilhkm79anwfr7kr9qjiz900c44";
fetchSubmodules = false;
};
};

View file

@ -1,3 +1,4 @@
---
# Fixes
- src: lewis6991/impatient.nvim
@ -18,7 +19,7 @@
# Syntax
- src: nvim-treesitter/nvim-treesitter
- src: p00f/nvim-ts-rainbow
- src: mrjones2014/nvim-ts-rainbow
- src: nvim-treesitter/playground
# Telescope
@ -35,7 +36,6 @@
# LSP
- src: neovim/nvim-lspconfig
- src: mfussenegger/nvim-jdtls
- src: "https://git.sr.ht/~whynothugo/lsp_lines.nvim"
- src: onsails/lspkind.nvim
- src: SmiteshP/nvim-navic
- src: RRethy/vim-illuminate