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 = {
border = "rounded",
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
package_installed = "i",
package_pending = "p",
package_uninstalled = "u",
},
},
log_level = vim.log.levels.INFO,

View File

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

View File

@ -7,7 +7,7 @@
[ -f "$XINITRC" ] && alias startx="startx $XINITRC"
# 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"
done; unset command
@ -40,9 +40,6 @@ alias \
lf="lfub" \
magit="nvim -c MagitOnly" \
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 \
@ -57,10 +54,11 @@ alias \
tmn="tmux new" \
tma="tmux-worker" \
tms="tmux-sessioniser" \
tm.="tmux-sessioniser \"$(pwd)\""
tm.="tmux-sessioniser ."
# Alias some extra things for ease of use
alias \
myip="curl api.ipify.org" \
cls="clear" \
c="clear"
c="clear" \
cdc="cd && clear"