changes here and there

This commit is contained in:
Solomon Laing 2022-11-19 17:10:01 +10:30
parent 8a9f62baaf
commit 0167541ae8
3 changed files with 67 additions and 54 deletions

View File

@ -36,9 +36,9 @@ local settings = {
ui = { ui = {
border = "rounded", border = "rounded",
icons = { icons = {
package_installed = "", package_installed = "i",
package_pending = "", package_pending = "p",
package_uninstalled = "", package_uninstalled = "u",
}, },
}, },
log_level = vim.log.levels.INFO, log_level = vim.log.levels.INFO,

View File

@ -1,6 +1,6 @@
local null_ls_status_ok, null_ls = pcall(require, "null-ls") local null_ls_status_ok, null_ls = pcall(require, "null-ls")
if not null_ls_status_ok then if not null_ls_status_ok then
return return
end end
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
@ -8,52 +8,67 @@ local formatting = null_ls.builtins.formatting
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
local diagnostics = null_ls.builtins.diagnostics local diagnostics = null_ls.builtins.diagnostics
-- https://github.com/prettier-solidity/prettier-plugin-solidity null_ls.setup({
-- npm install --save-dev prettier prettier-plugin-solidity debug = false,
null_ls.setup { sources = {
debug = false, formatting.prettier.with({
sources = { filetypes = {
formatting.prettier.with { "javascript",
extra_filetypes = { "toml", "solidity" }, "javascriptreact",
extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" }, "typescript",
}, "typescriptreact",
formatting.black.with { extra_args = { "--fast" } }, "vue",
formatting.stylua, "css",
-- formatting.shfmt, "scss",
formatting.google_java_format, "less",
formatting.bibclean, "html",
formatting.beautysh, "json",
-- diagnostics.flake8, "jsonc",
diagnostics.shellcheck, "yaml",
}, "graphql",
} "handlebars",
},
}),
formatting.deno_fmt.with({
filetypes = { "markdown" }, -- only runs `deno fmt` for markdown
}),
formatting.black.with({ extra_args = { "--fast" } }),
formatting.stylua,
-- formatting.shfmt,
formatting.google_java_format,
formatting.bibclean,
formatting.beautysh,
-- diagnostics.flake8,
diagnostics.shellcheck,
},
})
local unwrap = { local unwrap = {
method = null_ls.methods.DIAGNOSTICS, method = null_ls.methods.DIAGNOSTICS,
filetypes = { "rust" }, filetypes = { "rust" },
generator = { generator = {
fn = function(params) fn = function(params)
local diagnostics = {} local diagnostics = {}
-- sources have access to a params object -- sources have access to a params object
-- containing info about the current file and editor state -- containing info about the current file and editor state
for i, line in ipairs(params.content) do for i, line in ipairs(params.content) do
local col, end_col = line:find "unwrap()" local col, end_col = line:find("unwrap()")
if col and end_col then if col and end_col then
-- null-ls fills in undefined positions -- null-ls fills in undefined positions
-- and converts source diagnostics into the required format -- and converts source diagnostics into the required format
table.insert(diagnostics, { table.insert(diagnostics, {
row = i, row = i,
col = col, col = col,
end_col = end_col, end_col = end_col,
source = "unwrap", source = "unwrap",
message = "hey " .. os.getenv("USER") .. ", don't forget to handle this" , message = "hey " .. os.getenv("USER") .. ", don't forget to handle this",
severity = 2, severity = 2,
}) })
end end
end end
return diagnostics return diagnostics
end, end,
}, },
} }
null_ls.register(unwrap) null_ls.register(unwrap)

View File

@ -7,7 +7,7 @@
[ -f "$XINITRC" ] && alias startx="startx $XINITRC" [ -f "$XINITRC" ] && alias startx="startx $XINITRC"
# sudo not required for some system commands # sudo not required for some system commands
for command in mount umount sv pacman updatedb su shutdown poweroff reboot ; do for command in mount umount pacman su shutdown poweroff reboot ; do
alias $command="sudo $command" alias $command="sudo $command"
done; unset command done; unset command
@ -40,9 +40,6 @@ alias \
lf="lfub" \ lf="lfub" \
magit="nvim -c MagitOnly" \ magit="nvim -c MagitOnly" \
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \ ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
weath="less -S ${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" \
# Everything above this comes from Luke Smiths voidrice.
# Alias dotfiles/config related commands # Alias dotfiles/config related commands
alias \ alias \
@ -57,10 +54,11 @@ alias \
tmn="tmux new" \ tmn="tmux new" \
tma="tmux-worker" \ tma="tmux-worker" \
tms="tmux-sessioniser" \ tms="tmux-sessioniser" \
tm.="tmux-sessioniser \"$(pwd)\"" tm.="tmux-sessioniser ."
# Alias some extra things for ease of use # Alias some extra things for ease of use
alias \ alias \
myip="curl api.ipify.org" \ myip="curl api.ipify.org" \
cls="clear" \ cls="clear" \
c="clear" c="clear" \
cdc="cd && clear"