merge: develop <--- feat/nvim-minor-improvements
* HEAD | \ | *38568df
<github@luxolus.com> nvim: improve cspell.json file handling | *afaf382
<github@luxolus.com> nvim: improve ToggleGutter to remove indent trace, diagnostics | / | develop Signed-off-by: Bazaah <github@luxolus.com>
This commit is contained in:
commit
ac705ce937
|
@ -4,18 +4,22 @@ local M, S = {}, {}
|
|||
|
||||
---Toggle the line numbers and diagnostic gutter
|
||||
function M.ToggleGutter()
|
||||
local o = vim.opt
|
||||
local o, diagnostic = vim.opt, vim.diagnostic
|
||||
|
||||
if o.number:get() then
|
||||
S.signcolumn = o.signcolumn:get()
|
||||
o.number = false
|
||||
o.relativenumber = false
|
||||
o.signcolumn = 'no'
|
||||
diagnostic.enable(false)
|
||||
else
|
||||
o.number = true
|
||||
o.relativenumber = true
|
||||
o.signcolumn = S.signcolumn or 'yes:1'
|
||||
diagnostic.enable(true)
|
||||
end
|
||||
|
||||
vim.cmd 'IBLToggle'
|
||||
end
|
||||
|
||||
---Open a float with your local config files
|
||||
|
|
|
@ -144,8 +144,12 @@ return {
|
|||
|
||||
-- CSpell setup
|
||||
local cspell = require 'cspell'
|
||||
local cspell_config_json = function(_)
|
||||
return vim.fn.stdpath('config') .. '/cspell.json'
|
||||
end
|
||||
local cspell_opts = {
|
||||
config = {
|
||||
find_json = cspell_config_json,
|
||||
on_add_to_json = function(payload)
|
||||
if vim.fn.executable('jq') == 0 then return end
|
||||
|
||||
|
@ -172,6 +176,12 @@ return {
|
|||
end,
|
||||
}
|
||||
|
||||
-- Ensure our config file exists, otherwise cspell complains
|
||||
local uv = (vim.uv or vim.loop);
|
||||
if not uv.fs_stat(cspell_config_json()) then
|
||||
vim.fn.writefile({'{}'}, cspell_config_json())
|
||||
end
|
||||
|
||||
opts.sources = vim.tbl_extend('force', opts.sources or {}, {
|
||||
cspell.diagnostics.with(cspell_opts),
|
||||
cspell.code_actions.with(cspell_opts),
|
||||
|
|
Loading…
Reference in New Issue