forked from mirrors_public/oddlama_nix-config
feat(neovim): wip: add most of the missing plugins
This commit is contained in:
parent
ae7ecf6885
commit
a70015bd2c
1 changed files with 200 additions and 55 deletions
|
@ -1,16 +1,22 @@
|
||||||
# TODO whichkey
|
# TODO whichkey
|
||||||
|
# TODO vim illuminate
|
||||||
# TODO alpha menu
|
# TODO alpha menu
|
||||||
# TODO keybinds
|
# TODO keybinds
|
||||||
# TODO window select
|
# TODO dap dapui
|
||||||
# TODO neotree left darker
|
# TODO neotree left darker
|
||||||
# TODO neotree focsed shows lualine wrongly (full instead of nothing)
|
# TODO neotree focsed shows lualine wrongly (full instead of nothing)
|
||||||
# TODO lualine inactive ------ is ugly
|
# TODO lualine inactive ------ is ugly
|
||||||
|
# TODO move lines. gomove again?
|
||||||
|
# TODO vim-wordmotion vs https://github.com/chrisgrieser/nvim-various-textobjs
|
||||||
|
# TODO blankline cur indent too bright
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
# TODO use programs.nixvim? and split stuff a little.
|
||||||
home.shellAliases.nixvim = lib.getExe (pkgs.nixvim.makeNixvim {
|
home.shellAliases.nixvim = lib.getExe (pkgs.nixvim.makeNixvim {
|
||||||
|
# TODO away once we are ready to switch (prevents shada and undohist currently)
|
||||||
package = pkgs.neovim-clean;
|
package = pkgs.neovim-clean;
|
||||||
|
|
||||||
# TODO for wayland:
|
# TODO for wayland:
|
||||||
|
@ -31,6 +37,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
luaLoader.enable = true;
|
||||||
globals.mapleader = ",";
|
globals.mapleader = ",";
|
||||||
|
|
||||||
# Hide line numbers in terminal windows
|
# Hide line numbers in terminal windows
|
||||||
|
@ -38,13 +45,26 @@
|
||||||
{
|
{
|
||||||
event = ["BufEnter" "BufWinEnter"];
|
event = ["BufEnter" "BufWinEnter"];
|
||||||
pattern = ["term://*"];
|
pattern = ["term://*"];
|
||||||
callback = {
|
callback.__raw = ''
|
||||||
__raw = ''
|
function()
|
||||||
function()
|
vim.bo.number = false
|
||||||
vim.bo.number = false
|
end
|
||||||
end
|
'';
|
||||||
'';
|
}
|
||||||
};
|
{
|
||||||
|
event = ["WinEnter"];
|
||||||
|
pattern = ["*"];
|
||||||
|
callback.__raw = ''
|
||||||
|
function()
|
||||||
|
pcall(function()
|
||||||
|
if vim.bo.buftype == "nofile" or vim.bo.buftype == "help" then
|
||||||
|
vim.cmd "DisableWhitespace"
|
||||||
|
else
|
||||||
|
vim.cmd "EnableWhitespace"
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -112,23 +132,134 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
keymaps = let
|
keymaps = let
|
||||||
withDefaults = lib.recursiveUpdate {
|
keymap = mode: key: action: desc: {
|
||||||
|
inherit action key mode;
|
||||||
options = {
|
options = {
|
||||||
silent = true;
|
silent = true;
|
||||||
noremap = true;
|
inherit desc;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in [
|
||||||
map withDefaults [
|
# -------------------------------------------------------------------------------------------------
|
||||||
{
|
# General
|
||||||
action = "<C-]>";
|
# -------------------------------------------------------------------------------------------------
|
||||||
key = "<CR>";
|
|
||||||
mode = ["n"];
|
# Shift + <up/down> scroll with cursor locked to position
|
||||||
options.desc = "Jump to tag under cursor";
|
(keymap ["n" "v"] "<S-Down>" "<C-e>" "")
|
||||||
}
|
(keymap ["n" "v"] "<S-Up>" "<C-y>" "")
|
||||||
];
|
(keymap ["i"] "<S-Down>" "<C-x><C-e>" "")
|
||||||
|
(keymap ["i"] "<S-Up>" "<C-x><C-y>" "")
|
||||||
|
|
||||||
|
# Shift + Alt + <arrow keys> change the current window size
|
||||||
|
(keymap ["n"] "<M-S-Up>" ":resize -2<CR>" "")
|
||||||
|
(keymap ["n"] "<M-S-Down>" ":resize +2<CR>" "")
|
||||||
|
(keymap ["n"] "<M-S-Left>" ":vertical resize -2<CR>" "")
|
||||||
|
(keymap ["n"] "<M-S-Right>" ":vertical resize +2<CR>" "")
|
||||||
|
|
||||||
|
# Allow exiting terminal mode
|
||||||
|
(keymap ["t"] "<C-w><Esc>" "<C-\\><C-n>" "")
|
||||||
|
# Allow C-w in terminal mode
|
||||||
|
(keymap ["t"] "<C-w>" "<C-\\><C-n><C-w>" "")
|
||||||
|
|
||||||
|
# Open fixed size terminal window at the bottom
|
||||||
|
(keymap ["n"] "<leader><CR>" ":belowright new | setlocal wfh | resize 10 | terminal<CR>" "")
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Language server
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(keymap ["n"] "gD" "<cmd>lua vim.lsp.buf.declaration()<CR>" "")
|
||||||
|
(keymap ["n"] "gd" "<cmd>lua require('telescope.builtin').lsp_definitions()<CR>" "")
|
||||||
|
(keymap ["n"] "K" "<cmd>lua vim.lsp.buf.hover()<CR>" "")
|
||||||
|
(keymap ["n"] "gi" "<cmd>lua require('telescope.builtin').lsp_implementations()<CR>" "")
|
||||||
|
(keymap ["n"] "<C-k>" "<cmd>lua vim.lsp.buf.signature_help()<CR>" "")
|
||||||
|
(keymap ["n"] "<leader>wa" "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>" "")
|
||||||
|
(keymap ["n"] "<leader>wr" "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>" "")
|
||||||
|
(keymap ["n"] "<leader>wl" "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>" "")
|
||||||
|
(keymap ["n"] "gt" "<cmd>lua require('telescope.builtin').lsp_type_definitions()<CR>" "")
|
||||||
|
(keymap ["n"] "<leader>r" "<cmd>lua vim.lsp.buf.rename()<CR>" "")
|
||||||
|
(keymap ["n"] "<leader>a" "<cmd>lua vim.lsp.buf.code_action()<CR>" "")
|
||||||
|
(keymap ["n"] "gr" "<cmd>lua require('telescope.builtin').lsp_references()<CR>" "")
|
||||||
|
(keymap ["n"] "gl" "<cmd>lua vim.diagnostic.open_float()<CR>" "")
|
||||||
|
(keymap ["n"] "[d" "<cmd>lua vim.diagnostic.goto_prev()<CR>" "")
|
||||||
|
(keymap ["n"] "]d" "<cmd>lua vim.diagnostic.goto_next()<CR>" "")
|
||||||
|
(keymap ["n"] "<leader>q" "<cmd>lua vim.diagnostic.setloclist()<CR>" "")
|
||||||
|
(keymap ["n"] "<leader>f" "<cmd>lua vim.lsp.buf.format { async = true }<CR>" "")
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Plugin: Easy Align
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(keymap ["n"] "<leader>A" "<Plug>(EasyAlign)" "")
|
||||||
|
(keymap ["v"] "<leader>A" "<Plug>(EasyAlign)" "")
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Plugin: Undotree
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(keymap ["n"] "<leader>u" ":UndotreeToggle<CR>" "")
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Plugin: Better Whitespace
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(keymap ["n"] "<leader>$" ":StripWhitespace<CR>" "")
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Plugin: Neotree
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Mappings to open the tree / find the current file
|
||||||
|
(keymap ["n"] "<leader>t" ":Neotree toggle<CR>" "")
|
||||||
|
(keymap ["n"] "<leader>T" ":Neotree reveal<CR>" "")
|
||||||
|
(keymap ["n"] "<leader>G" ":Neotree float git_status<CR>" "")
|
||||||
|
(keymap ["n"] "<leader>b" ":Neotree float buffers<CR>" "")
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Plugin: Sandwich
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(keymap ["n" "v"] "m" "<Plug>(operator-sandwich-add)" "")
|
||||||
|
(keymap ["n" "v"] "M" "<Plug>(operator-sandwich-delete)" "")
|
||||||
|
(keymap ["n" "v"] "C-m" "<Plug>(operator-sandwich-replace)" "")
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Plugin: gomove
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#(keymap ["n"] "<M-Left>" "<Plug>GoNSMLeft" "")
|
||||||
|
#(keymap ["n"] "<M-Down>" "<Plug>GoNSMDown" "")
|
||||||
|
#(keymap ["n"] "<M-Up>" "<Plug>GoNSMUp" "")
|
||||||
|
#(keymap ["n"] "<M-Right>" "<Plug>GoNSMRight" "")
|
||||||
|
|
||||||
|
(keymap ["x"] "<M-Left>" "<Plug>GoVSMLeft" "")
|
||||||
|
(keymap ["x"] "<M-Down>" "<Plug>GoVSMDown" "")
|
||||||
|
(keymap ["x"] "<M-Up>" "<Plug>GoVSMUp" "")
|
||||||
|
(keymap ["x"] "<M-Right>" "<Plug>GoVSMRight" "")
|
||||||
|
|
||||||
|
#(keymap ["n"] "<S-M-Left>" "<Plug>GoNSDLeft" "")
|
||||||
|
#(keymap ["n"] "<S-M-Down>" "<Plug>GoNSDDown" "")
|
||||||
|
#(keymap ["n"] "<S-M-Up>" "<Plug>GoNSDUp" "")
|
||||||
|
#(keymap ["n"] "<S-M-Right>" "<Plug>GoNSDRight" "")
|
||||||
|
|
||||||
|
(keymap ["x"] "<S-M-Left>" "<Plug>GoVSDLeft" "")
|
||||||
|
(keymap ["x"] "<S-M-Down>" "<Plug>GoVSDDown" "")
|
||||||
|
(keymap ["x"] "<S-M-Up>" "<Plug>GoVSDUp" "")
|
||||||
|
(keymap ["x"] "<S-M-Right>" "<Plug>GoVSDRight" "")
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Plugin: wordmotion
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(keymap ["x" "o"] "ie" "<Plug>WordMotion_iw" "")
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
# Plugin: textcase
|
||||||
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# TODO: ... keybinds + telescope integration
|
||||||
|
];
|
||||||
|
|
||||||
luaLoader.enable = true;
|
|
||||||
plugins = {
|
plugins = {
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
# Library plugins
|
# Library plugins
|
||||||
|
@ -181,18 +312,11 @@
|
||||||
# Line indentation markers
|
# Line indentation markers
|
||||||
indent-blankline.enable = true;
|
indent-blankline.enable = true;
|
||||||
|
|
||||||
# Show invalid whitespace
|
|
||||||
# TODO use { "ntpeters/vim-better-whitespace", config = conf_fn "better-whitespace" }
|
|
||||||
|
|
||||||
# Rainbow parentheses
|
# Rainbow parentheses
|
||||||
rainbow-delimiters.enable = true;
|
rainbow-delimiters.enable = true;
|
||||||
|
|
||||||
# Replace built-in LSP prompts and windows
|
|
||||||
# TODO use { "stevearc/dressing.nvim", config = conf_setup "dressing" }
|
|
||||||
# Status updates for LSP progress in right bottom corner.
|
# Status updates for LSP progress in right bottom corner.
|
||||||
fidget.enable = true;
|
fidget.enable = true;
|
||||||
# Show latex math equations
|
|
||||||
# TODO use { "jbyuki/nabla.nvim", config = conf_fn "nabla" }
|
|
||||||
# Show colors
|
# Show colors
|
||||||
nvim-colorizer.enable = true;
|
nvim-colorizer.enable = true;
|
||||||
|
|
||||||
|
@ -205,7 +329,7 @@
|
||||||
|
|
||||||
treesitter = {
|
treesitter = {
|
||||||
enable = true;
|
enable = true;
|
||||||
folding = true;
|
# TODO (autocmd * zR needed) folding = true;
|
||||||
indent = true;
|
indent = true;
|
||||||
|
|
||||||
incrementalSelection = {
|
incrementalSelection = {
|
||||||
|
@ -242,24 +366,10 @@
|
||||||
# Editing
|
# Editing
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Multicursor
|
|
||||||
# TODO use { "mg979/vim-visual-multi" }
|
|
||||||
# Commenting
|
# Commenting
|
||||||
comment-nvim.enable = true;
|
comment-nvim.enable = true;
|
||||||
# Modify Surrounding things like parenthesis and quotes
|
|
||||||
# TODO use { "machakann/vim-sandwich", config = conf_fn "sandwich" }
|
|
||||||
# Extend vim's "%" key
|
# Extend vim's "%" key
|
||||||
vim-matchup.enable = true;
|
vim-matchup.enable = true;
|
||||||
# Align
|
|
||||||
# TODO use "junegunn/vim-easy-align"
|
|
||||||
# Move blocks
|
|
||||||
# TODO use { "booperlv/nvim-gomove", config = conf_setup "gomove" }
|
|
||||||
# Case changer
|
|
||||||
# TODO use "johmsalas/text-case.nvim"
|
|
||||||
# camelcase (and similar) word motions and textobjects
|
|
||||||
# TODO use { "chaoren/vim-wordmotion", config = conf_fn "wordmotion" }
|
|
||||||
# Respect editor-config files
|
|
||||||
# TODO use { "gpanders/editorconfig.nvim" }
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------
|
||||||
# Functionality
|
# Functionality
|
||||||
|
@ -273,9 +383,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Startup screen
|
# Startup screen
|
||||||
# TODO use { "goolord/alpha-nvim", config = conf_module "alpha" }
|
alpha.enable = true;
|
||||||
# Window Picker
|
|
||||||
# TODO use { "s1n7ax/nvim-window-picker", tag = "v1.*", config = conf_setup "window-picker" }
|
|
||||||
# Filebrowser
|
# Filebrowser
|
||||||
neo-tree = {
|
neo-tree = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -338,9 +447,6 @@
|
||||||
windowLayout = 4;
|
windowLayout = 4;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Gpg integration
|
|
||||||
# TODO use "jamessan/vim-gnupg"
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
# Git
|
# Git
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
@ -351,14 +457,14 @@
|
||||||
# Git commands
|
# Git commands
|
||||||
fugitive.enable = true;
|
fugitive.enable = true;
|
||||||
|
|
||||||
|
diffview.enable = true;
|
||||||
|
|
||||||
# Manage git from within neovim
|
# Manage git from within neovim
|
||||||
neogit = {
|
neogit = {
|
||||||
enable = true;
|
enable = true;
|
||||||
disableBuiltinNotifications = true;
|
disableBuiltinNotifications = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
diffview.enable = true;
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
# Completion
|
# Completion
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
@ -554,7 +660,7 @@
|
||||||
Table = "",
|
Table = "",
|
||||||
Object = "",
|
Object = "",
|
||||||
Tag = "",
|
Tag = "",
|
||||||
Array = "[]",
|
Array = "",
|
||||||
Boolean = "",
|
Boolean = "",
|
||||||
Number = "",
|
Number = "",
|
||||||
Null = "",
|
Null = "",
|
||||||
|
@ -581,20 +687,45 @@
|
||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
# -------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# TODO use { "folke/trouble.nvim", config = conf_setup "trouble" }
|
|
||||||
# Quickfix menu
|
# Quickfix menu
|
||||||
trouble.enable = true;
|
trouble.enable = true;
|
||||||
# Highlight certain keywords
|
# Highlight certain keywords
|
||||||
todo-comments.enable = true;
|
todo-comments.enable = true;
|
||||||
# TODO use { "liuchengxu/vista.vim", cmd = "Vista" }
|
# TODO use { "liuchengxu/vista.vim", cmd = "Vista" }
|
||||||
|
which-key.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
extraPlugins = with pkgs.vimPlugins; [
|
||||||
|
telescope-ui-select-nvim
|
||||||
nvim-web-devicons
|
nvim-web-devicons
|
||||||
nvim-window-picker
|
nvim-window-picker
|
||||||
telescope-ui-select-nvim
|
# Replace built-in LSP prompts and windows
|
||||||
|
dressing-nvim
|
||||||
|
# Multicursor
|
||||||
|
vim-visual-multi
|
||||||
|
# Show invalid whitespace
|
||||||
|
vim-better-whitespace
|
||||||
|
# Show latex math equations
|
||||||
|
nabla-nvim
|
||||||
|
# Modify Surrounding things like parenthesis and quotes
|
||||||
|
vim-sandwich
|
||||||
|
# TODO mini.align better?
|
||||||
|
vim-easy-align
|
||||||
|
# Case changer
|
||||||
|
text-case-nvim
|
||||||
|
# camelcase (and similar) word motions and textobjects
|
||||||
|
vim-wordmotion
|
||||||
|
# Gpg integration
|
||||||
|
vim-gnupg
|
||||||
];
|
];
|
||||||
|
|
||||||
|
extraConfigLuaPre = ''
|
||||||
|
vim.g.operator_sandwich_no_default_key_mappings = 1
|
||||||
|
vim.g.textobj_sandwich_no_default_key_mappings = 1
|
||||||
|
|
||||||
|
vim.g.wordmotion_nomap = 1
|
||||||
|
'';
|
||||||
|
|
||||||
extraConfigLuaPost = ''
|
extraConfigLuaPost = ''
|
||||||
require("nvim-web-devicons").setup {
|
require("nvim-web-devicons").setup {
|
||||||
override = {
|
override = {
|
||||||
|
@ -642,14 +773,28 @@
|
||||||
|
|
||||||
require("window-picker").setup {
|
require("window-picker").setup {
|
||||||
hint = "floating-big-letter",
|
hint = "floating-big-letter",
|
||||||
selection_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
||||||
filter_rules = {
|
filter_rules = {
|
||||||
bo = {
|
bo = {
|
||||||
filetype = { "neo-tree", "neo-tree-popup", "notify", "quickfix" },
|
filetype = { "neo-tree", "neo-tree-popup", "notify", "quickfix" },
|
||||||
buftype = { "terminal", "quickfix", "prompt" },
|
buftype = { "terminal", "quickfix", "prompt" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
other_win_hl_color = "#4493c8",
|
floating_big_letter = {
|
||||||
|
font = "ansi-shadow",
|
||||||
|
},
|
||||||
|
selection_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||||
|
show_prompt = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("dressing").setup {
|
||||||
|
input = {
|
||||||
|
prefer_width = 80,
|
||||||
|
max_width = { 140, 0.9 },
|
||||||
|
min_width = { 80, 0.6 },
|
||||||
|
win_options = {
|
||||||
|
winblend = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue