Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mrjones2014/dotfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Jan 19, 2024
2 parents dcd7fea + e29f99c commit 7bfb914
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 84 deletions.
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 16 additions & 19 deletions nvim/lua/my/configure/heirline/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,22 @@ M.FilePath = {
}

local icons = require('my.lsp.icons')
local severities_order = { 'Hint', 'Information', 'Warning', 'Error' }
local severity_hl = { Hint = 'Hint', Information = 'Info', Warning = 'Warn', Error = 'Error' }
local severities = {
Hint = vim.diagnostic.severity.HINT,
Information = vim.diagnostic.severity.INFO,
Warning = vim.diagnostic.severity.WARN,
Error = vim.diagnostic.severity.ERROR,
local diagnostics_order = {
vim.diagnostic.severity.HINT,
vim.diagnostic.severity.INFO,
vim.diagnostic.severity.WARN,
vim.diagnostic.severity.ERROR,
}
local severity_hl = {
[vim.diagnostic.severity.HINT] = 'Hint',
[vim.diagnostic.severity.INFO] = 'Info',
[vim.diagnostic.severity.WARN] = 'Warn',
[vim.diagnostic.severity.ERROR] = 'Error',
}
local diagnostics_base = {
update = { 'DiagnosticChanged', 'BufEnter' },
init = function(self)
local all_diagnostics = vim.diagnostic.get(0)
for key, severity in pairs(severities) do
self[key] = #vim
.iter(all_diagnostics)
:filter(function(d)
return d.severity == severity
end)
:totable()
end
self.counts = vim.diagnostic.count(0)
end,
}

Expand All @@ -69,19 +66,19 @@ function M.Diagnostics(is_winbar, bg)
return utils.insert(
diagnostics_base,
unpack(vim
.iter(severities_order)
.iter(diagnostics_order)
:map(function(severity)
local component = {
provider = function(self)
return string.format('%s%s ', icons[severity], self[severity])
return string.format('%s%s ', icons[severity], self.counts[severity] or 0)
end,
hl = function()
return { fg = utils.get_highlight(string.format('DiagnosticSign%s', severity_hl[severity])).fg, bg = bg }
end,
}
if is_winbar then
component.condition = function(self)
return self[severity] > 0
return (self.counts[severity] or 0) > 0
end
end
return component
Expand Down
3 changes: 1 addition & 2 deletions nvim/lua/my/configure/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ return {
callback = function(display)
if nvim_navbuddy_telescope == nil then
nvim_navbuddy_telescope = require('nvim-navbuddy.actions').telescope({
layout_strategy = 'horizontal',
layout_config = {
height = 0.60,
width = 0.60,
prompt_position = 'top',
preview_width = 0.50,
},
layout_strategy = 'horizontal',
})
end
return nvim_navbuddy_telescope.callback(display)
Expand Down
5 changes: 5 additions & 0 deletions nvim/lua/my/lsp/icons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ for _, key in ipairs(vim.tbl_keys(signs)) do
signs[string.format('DiagnosticSign%s', key)] = signs[key]
end

signs[vim.diagnostic.severity.HINT] = signs.Hint
signs[vim.diagnostic.severity.INFO] = signs.Info
signs[vim.diagnostic.severity.WARN] = signs.Warn
signs[vim.diagnostic.severity.ERROR] = signs.Error

return signs
40 changes: 19 additions & 21 deletions nvim/lua/my/lsp/rust.lua
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
return {
-- before_init = function(_, config)
-- -- Override clippy to run in its own directory to avoid clobbering caches
-- -- but only if target-dir isn't already set in either the command or the extraArgs
-- local checkOnSave = config.settings['rust-analyzer'].checkOnSave
-- local needle = '--target-dir'
-- if string.find(checkOnSave.command, needle, nil, true) then
-- return
-- end
--
-- checkOnSave.extraArgs = checkOnSave.extraArgs or {}
-- for _, v in pairs(checkOnSave.extraArgs or {}) do
-- if string.find(v, needle, nil, true) then
-- return
-- end
-- end
--
-- p({ 'before', checkOnSave.extraArgs, checkOnSave.command })
-- local target_dir = config.root_dir .. '/target/ide-clippy'
-- table.insert(checkOnSave.extraArgs, '--target-dir=' .. target_dir)
-- p({ 'after', checkOnSave.extraArgs })
-- end,
before_init = function(_, config)
-- Override clippy to run in its own directory to avoid clobbering caches
-- but only if target-dir isn't already set in either the command or the extraArgs
local checkOnSave = config.settings['rust-analyzer'].checkOnSave
local needle = '--target-dir'
if string.find(checkOnSave.command, needle, nil, true) then
return
end

checkOnSave.extraArgs = checkOnSave.extraArgs or {}
for _, v in pairs(checkOnSave.extraArgs or {}) do
if string.find(v, needle, nil, true) then
return
end
end

local target_dir = config.root_dir .. '/target/ide-clippy'
table.insert(checkOnSave.extraArgs, '--target-dir=' .. target_dir)
end,
settings = {
['rust-analyzer'] = {
checkOnSave = {
Expand Down
2 changes: 1 addition & 1 deletion nvim/lua/my/lsp/utils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function M.setup_async_formatting()
err = vim.inspect(err)
end
end
vim.api.nvim_err_write(err)
vim.api.nvim_err_write(err --[[@as string]])
return
end

Expand Down
31 changes: 0 additions & 31 deletions packages/cbfmt.nix

This file was deleted.

1 change: 0 additions & 1 deletion packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ let
packages.aarch64-darwin.neovim;
in {
neovim-nightly = pkgs.callPackage ./neovim-nightly.nix { inherit neovim; };
cbfmt = pkgs.callPackage ./cbfmt.nix { };
}

0 comments on commit 7bfb914

Please sign in to comment.