Add other cool stuff to vim

This commit is contained in:
2023-02-24 21:48:13 +09:00
parent 1968d2ff60
commit a3bdb679e2
13 changed files with 269 additions and 72 deletions
Generated
+93 -1
View File
@@ -1,5 +1,36 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -81,7 +112,67 @@
"type": "github"
}
},
"neovim-flake": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"neovim-nightly",
"nixpkgs"
]
},
"locked": {
"dir": "contrib",
"lastModified": 1677101901,
"narHash": "sha256-908qXxXXsthrKxTeaX8IOW1O7s5gDr9nftumJdltDjs=",
"owner": "neovim",
"repo": "neovim",
"rev": "d422fc8274e757e95329e60b4e6daec59363ba19",
"type": "github"
},
"original": {
"dir": "contrib",
"owner": "neovim",
"repo": "neovim",
"type": "github"
}
},
"neovim-nightly": {
"inputs": {
"flake-compat": "flake-compat",
"neovim-flake": "neovim-flake",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1677140105,
"narHash": "sha256-7Wnu88AvyvWbJn+Bt7EIKgs9UzqYLMwPCFXFZvIwxoU=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "805c75a17eb7f5a4a53006d96e518adffe5c52b7",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1677080879,
"narHash": "sha256-0SjW4/d3Rkw6C7hHZ5lxT4r6Pw9vzQb6Il6zYWwe2Bo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f5dad40450d272a1ea2413f4a67ac08760649e89",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1675942811,
"narHash": "sha256-/v4Z9mJmADTpXrdIlAjFa1e+gkpIIROR670UVDQFwIw=",
@@ -117,7 +208,8 @@
"home-manager": "home-manager",
"hyprland": "hyprland",
"jq": "jq",
"nixpkgs": "nixpkgs",
"neovim-nightly": "neovim-nightly",
"nixpkgs": "nixpkgs_2",
"nur": "nur"
}
},
+3
View File
@@ -11,6 +11,7 @@
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-nightly.url = "github:nix-community/neovim-nightly-overlay";
nur.url = "github:nix-community/NUR";
jq = {
url = "github:reegnz/jq-zsh-plugin";
@@ -22,6 +23,7 @@
self,
home-manager,
hyprland,
neovim-nightly,
nur,
...
} @ rawInput: let
@@ -82,6 +84,7 @@
};
nixpkgs.overlays = [
nur.overlay
neovim-nightly.overlay
];
}
+2 -1
View File
@@ -13,7 +13,8 @@ in {
programs.git = {
enable = true;
difftastic = {
enable = true;
# This breaks telescope's git status and I don't want to debug why
enable = false;
display = "inline";
};
signing = {
+8 -1
View File
@@ -9,7 +9,7 @@ in {
options.modules.nvim = {enable = lib.mkEnableOption "nvim";};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [neovim];
home.packages = with pkgs; [neovim-nightly];
xdg.configFile."nvim/lua".source = ./lua;
xdg.configFile."nvim/lazy-lock.json".source = ./lazy-lock.json;
@@ -19,5 +19,12 @@ in {
${builtins.readFile ./init.lua}
'';
programs.zsh.shellAliases = {
n = "nvim";
vim = "nvim";
vi = "nvim";
v = "nvim";
};
};
}
+14 -7
View File
@@ -1,7 +1,9 @@
{
"Comment.nvim": { "branch": "master", "commit": "6821b3ae27a57f1f3cf8ed030e4a55d70d0c4e43" },
"LuaSnip": { "branch": "master", "commit": "d33cf7de14eea209b8ed4a7edaed72f0b8cedb30" },
"SchemaStore.nvim": { "branch": "main", "commit": "9c3593f5400d84586ccf89cc436f1ab22d13c3df" },
"LuaSnip": { "branch": "master", "commit": "f7c845749aba6096f041a73a26ba64f3817bab99" },
"ReplaceWithRegister": { "branch": "master", "commit": "832efc23111d19591d495dc72286de2fb0b09345" },
"SchemaStore.nvim": { "branch": "main", "commit": "6f2ffb8420422db9a6c43dbce7227f0fdb9fcf75" },
"auto-save.nvim": { "branch": "main", "commit": "94003fec719ac04dac8a055c9b1baab6de4ac152" },
"catppuccin": { "branch": "main", "commit": "4175759297350557315987d479fb687a9f0b781f" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
@@ -10,7 +12,7 @@
"dressing.nvim": { "branch": "master", "commit": "db716a0f1279f79a886c0e0b6ab3c3d5ffdb42fe" },
"friendly-snippets": { "branch": "main", "commit": "6fa50a94ba5378bb73013a6e163376d8e69bd8a5" },
"gitsigns.nvim": { "branch": "main", "commit": "f388995990aba04cfdc7c3ab870c33e280601109" },
"harpoon": { "branch": "master", "commit": "8faeac2b91e2d0f1a27cae992340a791cbdc2da8" },
"harpoon": { "branch": "master", "commit": "f7040fd0c44e7a4010369136547de5604b9c22a1" },
"increment-activator": { "branch": "master", "commit": "55efcff88be45bd98cfdf7333dd718399373d10c" },
"indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" },
"lazy-lsp.nvim": { "branch": "master", "commit": "d22d54c7558415faf6f518db1e00d995d595a99d" },
@@ -18,28 +20,33 @@
"leap.nvim": { "branch": "main", "commit": "9a69febb2e5a4f5f5a55dd2d7173098fde917bc5" },
"lsp_signature.nvim": { "branch": "master", "commit": "6f6252f63b0baf0f2224c4caea33819a27f3f550" },
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
"mini.align": { "branch": "main", "commit": "b088ddab3495e5c1c84681e6db23dd3cc0660683" },
"mini.pairs": { "branch": "main", "commit": "4ebc1ff8d77fe75e8f219432302800ca29e17614" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "74040b34278910d9b467fd914862e2a9a1ebacaa" },
"neodev.nvim": { "branch": "main", "commit": "6d362921d772963e5a5e5ed0fcf82153defaf206" },
"neodev.nvim": { "branch": "main", "commit": "3c6e485bb3ff819c33e8f24847ba7d421d658569" },
"neodim": { "branch": "master", "commit": "c346344ade2ce709e6bd282f10e43778672b861e" },
"noice.nvim": { "branch": "main", "commit": "d8a1f3056ad713b5d471048f8d029264828e22c0" },
"nui.nvim": { "branch": "main", "commit": "d147222a1300901656f3ebd5b95f91732785a329" },
"nvim-cmp": { "branch": "main", "commit": "ba7a53478d0726683d1597ad1e814695033dcb4b" },
"nvim-cmp": { "branch": "main", "commit": "7a3b1e76f74934b12fda82158237c6ad8bfd3d40" },
"nvim-colorizer.lua": { "branch": "master", "commit": "550332c5791c6cad6fc7a80c26104de1d00b4692" },
"nvim-lspconfig": { "branch": "master", "commit": "91998cef4b1ae3a624901d0f9c894409db24e760" },
"nvim-lspconfig": { "branch": "master", "commit": "69e2fe3d638566a812c39bc4ea1980f7b833e2fc" },
"nvim-navic": { "branch": "master", "commit": "7e9d2b2b601149fecdccd11b516acb721e571fe6" },
"nvim-scrollbar": { "branch": "main", "commit": "75210c554e935740448cfb532d8a671ae544bb1b" },
"nvim-treesitter": { "branch": "master", "commit": "3044180ce0d27c2f85b86d6602f46244f0fdd8b2" },
"nvim-treesitter": { "branch": "master", "commit": "f8595b13bff62d5c64d54840e16678b9ad843620" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "2f3583001e2bf793480f38cf0d055571787b0259" },
"nvim-ts-autotag": { "branch": "main", "commit": "fdefe46c6807441460f11f11a167a2baf8e4534b" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" },
"nvim-web-devicons": { "branch": "master", "commit": "4709a504d2cd2680fb511675e64ef2790d491d36" },
"plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
"telescope-fzf-native.nvim": { "branch": "feature/69-prebuilt-release-binaries", "commit": "6388c4f4ec5eab8b89f974a9fa57fc955a67bbb2" },
"telescope.nvim": { "branch": "master", "commit": "a486ac3e8fb2198f3636da1927ed57a28836fbd8" },
"trouble.nvim": { "branch": "main", "commit": "3b754285635a66a93aeb15fa71a23417d8997217" },
"unimpaired-which-key.nvim": { "branch": "main", "commit": "321a247ecbbb31a59a8580350eec044b88d82e81" },
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-unimpaired": { "branch": "master", "commit": "6d44a6dc2ec34607c41ec78acf81657248580bf1" },
"vim-wordmotion": { "branch": "master", "commit": "5dd613ed68a0ecf0fc6c11cd4098c03583786bf0" },
"virt-column.nvim": { "branch": "master", "commit": "93b40ea038f676f5a72d7d1f2336fe7b051fc0ce" },
"which-key.nvim": { "branch": "main", "commit": "5224c261825263f46f6771f1b644cae33cd06995" }
}
+1 -1
View File
@@ -70,7 +70,7 @@ return {
return ""
end,
color = "ErrorMsg",
cond = function() return not auto_save_state end,
cond = function() return not vim.g.auto_save_state end,
},
{ 'filetype', colored = true, icon_only = true, separator = "", padding = { left = 1, right = 0 } },
{
+47 -28
View File
@@ -1,29 +1,3 @@
local nullls = {
"jose-elias-alvarez/null-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = { "mason.nvim" },
opts = function()
local nls = require("null-ls")
local sources = {
nl.builtins.code_actions.eslint_d,
nl.builtins.diagnostics.eslint_d,
nl.builtins.formatting.eslint_d,
nl.builtins.formatting.prettierd,
nl.builtins.formatting.black,
}
return {
sources = vim.tbl_map(function(source)
return source.with({
diagnostics_postprocess = function(diagnostic)
diagnostic.severity = vim.diagnostic.severity.HINT
end,
})
end, sources),
}
end,
}
local lsp_keymaps = function(buffer)
local function map(mode, l, r, desc)
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
@@ -35,7 +9,7 @@ local lsp_keymaps = function(buffer)
map("n", "gD", '<cmd>lua vim.lsp.buf.declaration()<CR>', "Go to declaration")
map("n", "gd", '<cmd>lua vim.lsp.buf.definition()<CR>', "Go to definition")
map("n", "gI", '<cmd>lua vim.lsp.buf.implementation()<CR>', "Go to implementation")
map("n", "gr", '<cmd>lua vim.lsp.buf.references()<CR>', "Go to reference(s)")
map("n", "gR", '<cmd>lua vim.lsp.buf.references()<CR>', "Go to reference(s)")
map("n", "gs", '<cmd>lua vim.lsp.buf.type_definition()<CR>', "Type definition")
map("n", "<leader>lr", '<cmd>lua vim.lsp.buf.rename()<CR>', "Rename")
@@ -115,11 +89,16 @@ return {
end
local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
-- local lspconfig = require("lspconfig")
return {
excluded_servers = {
-- Disable generic purpose LSP that I don't care about.
"efm",
"diagnosticls"
"diagnosticls",
-- Prefer tsserver
"denols",
"eslint",
},
default_config = {
on_attach = lsp_on_attach,
@@ -136,6 +115,12 @@ return {
},
},
},
tsserver = {
on_attach = lsp_on_attach,
capabilities = lsp_capabilities,
-- root_dir = lspconfig.util.root_pattern("yarn.lock", "package-lock.json", ".git"),
-- single_file_support = false,
},
},
}
end,
@@ -286,4 +271,38 @@ return {
floating_window = false,
}
},
-- {
-- "jose-elias-alvarez/null-ls.nvim",
-- event = { "BufReadPre", "BufNewFile" },
-- opts = function()
-- local nl = require("null-ls")
-- local with_nix = function(pkg, nixpkg)
-- return pkg.with({
-- command = "nix-shell",
-- -- This relies on the presence of _opts that contains the metadata of the package. This could break.
-- args = function(opt)
-- local def_args = type(pkg._opts.args) == "function" and pkg._opts.args(opt) or pkg._opts.args
-- return { "-p", nixpkg, "--run", table.concat({pkg._opts.command, unpack(def_args)}, " ") }
-- end,
-- })
-- end
-- local sources = {
-- with_nix(nl.builtins.code_actions.eslint_d, "nodePackages_latest.eslint_d"),
-- with_nix(nl.builtins.diagnostics.eslint_d, "nodePackages_latest.eslint_d"),
-- with_nix(nl.builtins.formatting.eslint_d, "nodePackages_latest.eslint_d"),
-- with_nix(nl.builtins.formatting.prettierd, "nodePackages.prettier_d_slim"),
-- }
-- return {
-- sources = vim.tbl_map(function(source)
-- return source.with({
-- diagnostics_postprocess = function(diagnostic)
-- diagnostic.severity = vim.diagnostic.severity.HINT
-- end,
-- })
-- end, sources),
-- debug = true,
-- }
-- end,
-- }
}
+21
View File
@@ -0,0 +1,21 @@
return {
{
"zoriya/auto-save.nvim",
keys = {
{"<leader>w", "<cmd>ASToggle<cr>", desc = "Toggle autosave" },
},
events = {
"InsertLeave",
"TextChanged",
},
opts = {
write_all_buffers = true,
print_enabled = false,
callbacks = {
enabling = function() vim.g.auto_save_state = true end,
disabling = function() vim.g.auto_save_state = false end,
}
},
init = function () vim.g.auto_save_state = true end
},
}
+31
View File
@@ -54,4 +54,35 @@ return {
{ "<C-X>", desc = "Decrement" },
},
},
{
"vim-scripts/ReplaceWithRegister",
keys = {
{ "gr", desc = "Replace with register" }
},
},
{
"chaoren/vim-wordmotion",
keys = {
{ "gw", "<plug>WordMotion_w", desc = "Next small world", mode = { "n", "x", "o" } },
-- This overrides the default ge but i never used it.
{ "ge", "<plug>WordMotion_e", desc = "Next end of small world", mode = { "n", "x", "o" } },
{ "gb", "<plug>WordMotion_b", desc = "Previous small world", mode = { "n", "x", "o" } },
{ "igw", "<plug>WordMotion_iw", desc = "inner small word", mode = { "x", "o" } },
{ "agw", "<plug>WordMotion_aw", desc = "a small word (with white-space)", mode = { "x", "o" } },
},
init = function () vim.g.wordmotion_nomap = true end,
},
{
"echasnovski/mini.align",
keys = {
{"ga", desc = "Align" },
{"gA", desc = "Align with preview" }
},
config = function() require('mini.align').setup() end,
version = '*',
},
}
+1
View File
@@ -51,6 +51,7 @@ return {
},
},
filesystem = {
bind_to_cwd = false,
follow_current_file = true,
hijack_netrw_behavior = "open_current",
filtered_items = {
@@ -47,4 +47,19 @@ return {
}
end
},
{
"windwp/nvim-ts-autotag",
config = true,
ft = {
'html', 'javascript', 'typescript', 'javascriptreact', 'typescriptreact', 'svelte', 'vue', 'tsx', 'jsx',
'rescript', 'xml', 'php', 'markdown', 'glimmer', 'handlebars', 'hbs'
},
},
{
"echasnovski/mini.pairs",
version = '*',
config = function () require('mini.pairs').setup() end,
},
}
+13 -10
View File
@@ -94,16 +94,6 @@ return {
noremap = false,
})
-- TODO: Moves this to the settinsg.lua file and use the standard way
wk.register({
y = { "Yank to system clipboard" },
Y = { "Yank line to system clipboard" },
p = { "Past from system clipboard" },
P = { "Past line from system clipboard" },
}, {
prefix = "<leader>",
})
wk.register({
mode = { "n", "v" },
["g"] = { name = "+goto" },
@@ -158,4 +148,17 @@ return {
end
end,
},
{
"folke/trouble.nvim",
keys = {
{ "<leader>ld", "<cmd>Trouble document_diagnostics<cr>", "Document Diagnostics" },
{ "<leader>lw", "<cmd>Trouble workspace_diagnostics<cr>", "Workspace Diagnostics" },
{ "<leader>lt", "<cmd>TroubleToggle<CR>", "Toogle trouble window" },
},
opts = {
auto_close = true,
min_severity = "Warning",
},
},
}
+20 -23
View File
@@ -48,39 +48,36 @@ for k, v in pairs(options) do
end
vim.cmd("set formatoptions-=ro")
local opts = { noremap = true, silent = true }
local keymap = vim.api.nvim_set_keymap
vim.g.mapleader = " "
vim.g.maplocalleader = " "
local function keymap(mode, l, r, desc)
vim.keymap.set(mode, l, r, { noremap = true, silent = true, desc = desc })
end
-- Stay in indent mode
keymap("v", "<", "<gv", opts)
keymap("v", ">", ">gv", opts)
keymap("v", "<", "<gv")
keymap("v", ">", ">gv")
-- Move in insert mode --
keymap("i", "<A-j>", "<Down>", opts)
keymap("i", "<A-k>", "<Up>", opts)
keymap("i", "<A-h>", "<Left>", opts)
keymap("i", "<A-l>", "<Right>", opts)
keymap("i", "<A-j>", "<Down>")
keymap("i", "<A-k>", "<Up>")
keymap("i", "<A-h>", "<Left>")
keymap("i", "<A-l>", "<Right>")
keymap("i", "<C-BS>", "<C-w>", opts)
keymap("c", "<C-BS>", "<C-w>", opts)
keymap("i", "<C-H>", "<C-w>", opts) -- Keymap for CTRL-BACKSPACE on some termial emulators.
keymap("c", "<C-H>", "<C-w>", opts)
keymap("i", "<C-BS>", "<C-w>")
keymap("c", "<C-BS>", "<C-w>")
keymap("i", "<C-H>", "<C-w>") -- Keymap for CTRL-BACKSPACE on some termial emulators.
keymap("c", "<C-H>", "<C-w>")
keymap("n", "<leader>y", '"+y', opts)
keymap("x", "<leader>y", '"+y', opts)
keymap("n", "<leader>Y", '"+y$', opts)
keymap("x", "<leader>Y", '"+y$', opts)
keymap({"n", "x"}, "<leader>y", '"+y', "Yank to system clipboard")
keymap({"n", "x"}, "<leader>Y", '"+y$', "Yank line to system clipboard")
keymap("n", "<leader>p", '"+p', opts)
keymap("x", "<leader>p", '"+p', opts)
keymap("n", "<leader>P", '"+P', opts)
keymap("x", "<leader>P", '"+P', opts)
keymap({"n", "x"}, "<leader>p", '"+p', "Past from system clipboard")
keymap({"n", "x"}, "<leader>P", '"+P', "Past line from system clipboard")
keymap("t", "<C-W>", "<C-\\><C-N><C-W>", opts)
keymap("t", "<C-W>", "<C-\\><C-N><C-W>")
vim.cmd("autocmd FileType qf setl nolist")
vim.cmd("syntax on")