Compare commits

..

No commits in common. "2a3233a140278d690447616a57c8482c2f92a2ff" and "e19302fa190ad34a89e6fcddbcc9f58f765d1618" have entirely different histories.

5 changed files with 73 additions and 41 deletions

15
nvimrc
View File

@ -282,16 +282,6 @@ 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
@ -299,6 +289,11 @@ 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

@ -1,7 +0,0 @@
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

@ -1,22 +0,0 @@
-- 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

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