Compare commits

...

3 Commits

Author SHA1 Message Date
Rob Watson 2a3233a140 chore: add mise
continuous-integration/drone/push Build is passing Details
2024-04-08 09:33:22 +02:00
Rob Watson 56739dea0b chore(nvim): add aerial.nvim 2024-04-08 09:32:44 +02:00
Rob Watson a3f44dfdde chore(nvim): add conform.nvim 2024-04-08 09:31:50 +02:00
5 changed files with 41 additions and 73 deletions

15
nvimrc
View File

@ -282,6 +282,16 @@ packadd! vim-rhubarb " https://github.com/tpope/vim-rhubarb.git
packadd! editorconfig-vim " https://github.com/editorconfig/editorconfig-vim.git
packadd! vim-wordmotion " https://github.com/chaoren/vim-wordmotion.git
" aerial
packadd! aerial.nvim " https://github.com/stevearc/aerial.nvim.git
lua require "aerial_config"
" conform.nvim:
packadd! conform.nvim " https://github.com/stevearc/conform.nvim.git
lua require "conform_config"
" nvim-dap
packadd! nvim-dap " https://github.com/mfussenegger/nvim-dap.git
packadd! nvim-dap-go " https://github.com/leoluz/nvim-dap-go.git
@ -289,11 +299,6 @@ packadd! nvim-dap-ruby " https://github.com/suketa/nvim-dap-ruby.git
lua require "debugger"
" formatter.nvim:
packadd! formatter.nvim " https://github.com/mhartington/formatter.nvim.git
lua require "formatter_config"
" treesitter:
packadd! nvim-treesitter " https://github.com/nvim-treesitter/nvim-treesitter.git
packadd! nvim-treesitter-textobjects " https://github.com/nvim-treesitter/nvim-treesitter-textobjects.git

View File

@ -0,0 +1,7 @@
require("aerial").setup({
on_attach = function(bufnr)
vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>", { buffer = bufnr })
vim.keymap.set("n", "}", "<cmd>AerialNext<CR>", { buffer = bufnr })
end,
})
vim.keymap.set("n", "<leader>a", "<cmd>AerialToggle!<CR>")

View File

@ -0,0 +1,22 @@
-- TODO: prettierd
-- TODO: async save-on-write? Or set timeout.
require("conform").setup({
formatters_by_ft = {
javascript = { "prettier" },
go = { "goimports" },
lua = { "stylua" },
rust = { "rustfmt" },
typescript = { "prettier" },
typescriptreact = { "prettier" },
},
formatters = {
prettier = {
args = { "--stdin-filepath", "$FILENAME", "--single-quote" },
},
},
format_on_save = {
lsp_fallback = true,
},
log_level = vim.log.levels.ERROR,
notify_on_error = true,
})

View File

@ -1,62 +0,0 @@
local prettier = function()
return {
exe = Get_project_node_modules_path() .. "/.bin/prettier",
args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
stdin = true,
}
end
local goimports = function()
local args = {}
local mod_path = Get_project_go_module_path()
if mod_path ~= "" then
table.insert(args, "-local")
table.insert(args, mod_path)
end
return {
exe = "goimports",
args = args,
stdin = true,
}
end
local rustfmt = function()
return {
exe = "rustfmt",
args = { "--edition", "2021" },
stdin = true,
}
end
require("formatter").setup({
log_level = vim.log.levels.INFO,
filetype = {
javascript = { prettier },
typescript = { prettier },
typescriptreact = { prettier },
go = { goimports },
rust = { rustfmt },
-- https://github.com/JohnnyMorganz/StyLua
-- cargo install stylua --features lua54
lua = {
require("formatter.filetypes.lua").stylua,
},
},
})
-- TODO: use vim.api.nvim_create_augroup()
vim.api.nvim_exec2(
[[
augroup FormatAutogroup
autocmd!
autocmd BufWritePost *.js,*.ts,*.tsx,*.go,*.lua,*.rs silent FormatWrite
augroup END
]],
{ output = true }
)
local bufnr = vim.fn.bufnr("%")
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>F", "<Cmd>silent Format<CR>", { noremap = true, silent = true })

8
zshrc
View File

@ -166,12 +166,8 @@ if [ -f $ZDOTDIR/.zshrc.local ]; then
. $ZDOTDIR/.zshrc.local
fi
# set up asdf
if [ -f $HOME/.asdf/asdf.sh ]; then
. $HOME/.asdf/asdf.sh
else
echo "Warning: asdf not found, skipping"
fi
# set up mise
eval "$(~/.local/bin/mise activate zsh)"
# pnpm
export PNPM_HOME="/home/rob/.local/share/pnpm"