nixbook: add postman, gofmt, difftastic

This commit is contained in:
tristan 2024-10-24 10:45:15 +01:00
parent 825381f98b
commit a8c80aa3d5
9 changed files with 57 additions and 3 deletions

View file

@ -24,6 +24,7 @@ in
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "bak";
users.${user}.imports =
home-modules
++ [

View file

@ -66,6 +66,14 @@
key = "<C-S-Tab>";
action = "<CMD>tabprev<CR>";
}
{
key = "<leader>bn";
action = "<CMD>bnext<CR>";
}
{
key = "<leader>bp";
action = "<CMD>bprevious<CR>";
}
{
key = "gl";
action = "g$";
@ -155,6 +163,33 @@
}
];
autoCmd = [{
event = "BufWritePre";
pattern = "*.go";
# https://github.com/golang/tools/blob/master/gopls/doc/vim.md#imports-and-formatting
callback.__raw = ''
function()
local params = vim.lsp.util.make_range_params()
params.context = {only = {"source.organizeImports"}}
-- buf_request_sync defaults to a 1000ms timeout. Depending on your
-- machine and codebase, you may want longer. Add an additional
-- argument after params if you find that you have to write the file
-- twice for changes to be saved.
-- E.g., vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000)
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params)
for cid, res in pairs(result or {}) do
for _, r in pairs(res.result or {}) do
if r.edit then
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
vim.lsp.util.apply_workspace_edit(r.edit, enc)
end
end
end
vim.lsp.buf.format({async = false})
end
'';
}];
plugins = {
bufferline.enable = true;
web-devicons.enable = true;
@ -188,6 +223,7 @@
servers = {
ts-ls.enable = true;
nil-ls.enable = true;
yamlls.enable = true;
gopls.enable = true;
};
keymaps = {