testing nixvim
This commit is contained in:
@@ -16,6 +16,10 @@
|
|||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
nixvim = {
|
||||||
|
url = "github:nix-community/nixvim";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
#nix-gl = {
|
#nix-gl = {
|
||||||
# url = "github:nix-community/nixgl";
|
# url = "github:nix-community/nixgl";
|
||||||
# inputs.nixpkgs.follows = "nixpkgs";
|
# inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|||||||
27
home/extra/neovim/autocommands.nix
Normal file
27
home/extra/neovim/autocommands.nix
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim.autoCmd = [
|
||||||
|
# Vertically center document when entering insert mode
|
||||||
|
{
|
||||||
|
event = "InsertEnter";
|
||||||
|
command = "norm zz";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Open help in a vertical split
|
||||||
|
{
|
||||||
|
event = "FileType";
|
||||||
|
pattern = "help";
|
||||||
|
command = "wincmd L";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Enable spellcheck for some filetypes
|
||||||
|
{
|
||||||
|
event = "FileType";
|
||||||
|
pattern = [
|
||||||
|
"tex"
|
||||||
|
"latex"
|
||||||
|
"markdown"
|
||||||
|
];
|
||||||
|
command = "setlocal spell spelllang=en,fr";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
55
home/extra/neovim/completion.nix
Normal file
55
home/extra/neovim/completion.nix
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
opts.completeopt = ["menu" "menuone" "noselect"];
|
||||||
|
|
||||||
|
plugins = {
|
||||||
|
luasnip.enable = true;
|
||||||
|
|
||||||
|
lspkind = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
cmp = {
|
||||||
|
enable = true;
|
||||||
|
menu = {
|
||||||
|
nvim_lsp = "[LSP]";
|
||||||
|
nvim_lua = "[api]";
|
||||||
|
path = "[path]";
|
||||||
|
luasnip = "[snip]";
|
||||||
|
buffer = "[buffer]";
|
||||||
|
neorg = "[neorg]";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
cmp = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||||
|
|
||||||
|
mapping = {
|
||||||
|
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||||
|
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||||
|
"<C-Space>" = "cmp.mapping.complete()";
|
||||||
|
"<C-e>" = "cmp.mapping.close()";
|
||||||
|
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
|
||||||
|
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
|
||||||
|
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
||||||
|
};
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
{name = "path";}
|
||||||
|
{name = "nvim_lsp";}
|
||||||
|
{name = "luasnip";}
|
||||||
|
{
|
||||||
|
name = "buffer";
|
||||||
|
# Words from other open buffers can also be suggested.
|
||||||
|
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
|
||||||
|
}
|
||||||
|
{name = "neorg";}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,62 +1,23 @@
|
|||||||
{pkgs, ...}: let
|
{inputs, ...}: {
|
||||||
treesitterWithGrammars = pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [
|
imports = [
|
||||||
p.bash
|
inputs.nixvim.homeManagerModules.nixvim
|
||||||
p.comment
|
./autocommands.nix
|
||||||
p.css
|
./completion.nix
|
||||||
p.dockerfile
|
./keymappings.nix
|
||||||
p.fish
|
./options.nix
|
||||||
p.gitattributes
|
./plugins
|
||||||
p.gitignore
|
./todo.nix
|
||||||
p.go
|
];
|
||||||
p.gomod
|
|
||||||
p.gowork
|
|
||||||
p.hcl
|
|
||||||
p.javascript
|
|
||||||
p.jq
|
|
||||||
p.json5
|
|
||||||
p.json
|
|
||||||
p.lua
|
|
||||||
p.make
|
|
||||||
p.markdown
|
|
||||||
p.nix
|
|
||||||
p.python
|
|
||||||
p.rust
|
|
||||||
p.toml
|
|
||||||
p.typescript
|
|
||||||
p.vue
|
|
||||||
p.yaml
|
|
||||||
]);
|
|
||||||
|
|
||||||
treesitter-parsers = pkgs.symlinkJoin {
|
home.shellAliases.v = "nvim";
|
||||||
name = "treesitter-parsers";
|
|
||||||
paths = treesitterWithGrammars.dependencies;
|
programs.nixvim = {
|
||||||
};
|
|
||||||
in {
|
|
||||||
programs.neovim = {
|
|
||||||
enable = true;
|
enable = true;
|
||||||
defaultEditor = true;
|
defaultEditor = true;
|
||||||
package = pkgs.neovim-unwrapped;
|
|
||||||
|
viAlias = true;
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
coc.enable = false;
|
|
||||||
withNodeJs = true;
|
luaLoader.enable = true;
|
||||||
#package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default;
|
|
||||||
plugins = [
|
|
||||||
treesitterWithGrammars
|
|
||||||
];
|
|
||||||
};
|
|
||||||
home.file."./.config/nvim/" = {
|
|
||||||
source = ./nvim;
|
|
||||||
recursive = true;
|
|
||||||
};
|
|
||||||
home.file."./.config/nvim/lua/cnst/init.lua".text = ''
|
|
||||||
require("cnst.set")
|
|
||||||
require("cnst.remap")
|
|
||||||
vim.opt.runtimepath:append("${treesitter-parsers}")
|
|
||||||
'';
|
|
||||||
# Treesitter is configured as a locally developed module in lazy.nvim
|
|
||||||
# we hardcode a symlink here so that we can refer to it in our lazy config
|
|
||||||
home.file."./.local/share/nvim/nix/nvim-treesitter/" = {
|
|
||||||
recursive = true;
|
|
||||||
source = treesitterWithGrammars;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
81
home/extra/neovim/keymappings.nix
Normal file
81
home/extra/neovim/keymappings.nix
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
programs.nixvim = {
|
||||||
|
globals = {
|
||||||
|
mapleader = " ";
|
||||||
|
maplocalleader = " ";
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = let
|
||||||
|
normal =
|
||||||
|
lib.mapAttrsToList
|
||||||
|
(key: action: {
|
||||||
|
mode = "n";
|
||||||
|
inherit action key;
|
||||||
|
})
|
||||||
|
{
|
||||||
|
"<Space>" = "<NOP>";
|
||||||
|
|
||||||
|
# Esc to clear search results
|
||||||
|
"<esc>" = ":noh<CR>";
|
||||||
|
|
||||||
|
# fix Y behaviour
|
||||||
|
Y = "y$";
|
||||||
|
|
||||||
|
# back and fourth between the two most recent files
|
||||||
|
"<C-c>" = ":b#<CR>";
|
||||||
|
|
||||||
|
# close by Ctrl+x
|
||||||
|
"<C-x>" = ":close<CR>";
|
||||||
|
|
||||||
|
# save by Space+s or Ctrl+s
|
||||||
|
"<leader>s" = ":w<CR>";
|
||||||
|
"<C-s>" = ":w<CR>";
|
||||||
|
|
||||||
|
# navigate to left/right window
|
||||||
|
"<leader>h" = "<C-w>h";
|
||||||
|
"<leader>l" = "<C-w>l";
|
||||||
|
|
||||||
|
# Press 'H', 'L' to jump to start/end of a line (first/last character)
|
||||||
|
L = "$";
|
||||||
|
H = "^";
|
||||||
|
|
||||||
|
# resize with arrows
|
||||||
|
"<C-Up>" = ":resize -2<CR>";
|
||||||
|
"<C-Down>" = ":resize +2<CR>";
|
||||||
|
"<C-Left>" = ":vertical resize +2<CR>";
|
||||||
|
"<C-Right>" = ":vertical resize -2<CR>";
|
||||||
|
|
||||||
|
# move current line up/down
|
||||||
|
# M = Alt key
|
||||||
|
"<M-k>" = ":move-2<CR>";
|
||||||
|
"<M-j>" = ":move+<CR>";
|
||||||
|
|
||||||
|
"<leader>rp" = ":!remi push<CR>";
|
||||||
|
};
|
||||||
|
visual =
|
||||||
|
lib.mapAttrsToList
|
||||||
|
(key: action: {
|
||||||
|
mode = "v";
|
||||||
|
inherit action key;
|
||||||
|
})
|
||||||
|
{
|
||||||
|
# better indenting
|
||||||
|
">" = ">gv";
|
||||||
|
"<" = "<gv";
|
||||||
|
"<TAB>" = ">gv";
|
||||||
|
"<S-TAB>" = "<gv";
|
||||||
|
|
||||||
|
# move selected line / block of text in visual mode
|
||||||
|
"K" = ":m '<-2<CR>gv=gv";
|
||||||
|
"J" = ":m '>+1<CR>gv=gv";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
config.nixvim.helpers.keymaps.mkKeymaps
|
||||||
|
{options.silent = true;}
|
||||||
|
(normal ++ visual);
|
||||||
|
};
|
||||||
|
}
|
||||||
63
home/extra/neovim/options.nix
Normal file
63
home/extra/neovim/options.nix
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
globals = {
|
||||||
|
# Disable useless providers
|
||||||
|
loaded_ruby_provider = 0; # Ruby
|
||||||
|
loaded_perl_provider = 0; # Perl
|
||||||
|
loaded_python_provider = 0; # Python 2
|
||||||
|
};
|
||||||
|
|
||||||
|
clipboard = {
|
||||||
|
# Use system clipboard
|
||||||
|
register = "unnamedplus";
|
||||||
|
|
||||||
|
providers.wl-copy.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
opts = {
|
||||||
|
updatetime = 100; # Faster completion
|
||||||
|
|
||||||
|
# Line numbers
|
||||||
|
relativenumber = false; # Relative line numbers
|
||||||
|
number = true; # Display the absolute line number of the current line
|
||||||
|
hidden = true; # Keep closed buffer open in the background
|
||||||
|
mouse = "a"; # Enable mouse control
|
||||||
|
mousemodel = "extend"; # Mouse right-click extends the current selection
|
||||||
|
splitbelow = true; # A new window is put below the current one
|
||||||
|
splitright = true; # A new window is put right of the current one
|
||||||
|
|
||||||
|
swapfile = false; # Disable the swap file
|
||||||
|
modeline = true; # Tags such as 'vim:ft=sh'
|
||||||
|
modelines = 100; # Sets the type of modelines
|
||||||
|
undofile = true; # Automatically save and restore undo history
|
||||||
|
incsearch = true; # Incremental search: show match for partly typed search command
|
||||||
|
inccommand = "split"; # Search and replace: preview changes in quickfix list
|
||||||
|
ignorecase = true; # When the search query is lower-case, match both lower and upper-case
|
||||||
|
# patterns
|
||||||
|
smartcase = true; # Override the 'ignorecase' option if the search pattern contains upper
|
||||||
|
# case characters
|
||||||
|
scrolloff = 8; # Number of screen lines to show around the cursor
|
||||||
|
cursorline = false; # Highlight the screen line of the cursor
|
||||||
|
cursorcolumn = false; # Highlight the screen column of the cursor
|
||||||
|
signcolumn = "yes"; # Whether to show the signcolumn
|
||||||
|
colorcolumn = "100"; # Columns to highlight
|
||||||
|
laststatus = 3; # When to use a status line for the last window
|
||||||
|
fileencoding = "utf-8"; # File-content encoding for the current buffer
|
||||||
|
termguicolors = true; # Enables 24-bit RGB color in the |TUI|
|
||||||
|
spell = false; # Highlight spelling mistakes (local to window)
|
||||||
|
wrap = false; # Prevent text from wrapping
|
||||||
|
|
||||||
|
# Tab options
|
||||||
|
tabstop = 4; # Number of spaces a <Tab> in the text stands for (local to buffer)
|
||||||
|
shiftwidth = 4; # Number of spaces used for each step of (auto)indent (local to buffer)
|
||||||
|
expandtab = true; # Expand <Tab> to spaces in Insert mode (local to buffer)
|
||||||
|
autoindent = true; # Do clever autoindenting
|
||||||
|
|
||||||
|
textwidth = 0; # Maximum width of text that is being inserted. A longer line will be
|
||||||
|
# broken after white space to get this width.
|
||||||
|
|
||||||
|
# Folding
|
||||||
|
foldlevel = 99; # Folds with a level higher than this number will be closed
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
10
home/extra/neovim/plugins/barbar.nix
Normal file
10
home/extra/neovim/plugins/barbar.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim.plugins.barbar = {
|
||||||
|
enable = true;
|
||||||
|
keymaps = {
|
||||||
|
next.key = "<TAB>";
|
||||||
|
previous.key = "<S-TAB>";
|
||||||
|
close.key = "<C-w>";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
10
home/extra/neovim/plugins/comment.nix
Normal file
10
home/extra/neovim/plugins/comment.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim.plugins.comment = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
opleader.line = "<C-b>";
|
||||||
|
toggler.line = "<C-b>";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
56
home/extra/neovim/plugins/default.nix
Normal file
56
home/extra/neovim/plugins/default.nix
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./barbar.nix
|
||||||
|
./comment.nix
|
||||||
|
./efm.nix
|
||||||
|
./floaterm.nix
|
||||||
|
./harpoon.nix
|
||||||
|
./lsp.nix
|
||||||
|
./lualine.nix
|
||||||
|
./markdown-preview.nix
|
||||||
|
./neorg.nix
|
||||||
|
./neo-tree.nix
|
||||||
|
./startify.nix
|
||||||
|
./tagbar.nix
|
||||||
|
./telescope.nix
|
||||||
|
./treesitter.nix
|
||||||
|
./vimtex.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.nixvim = {
|
||||||
|
colorschemes.gruvbox.enable = true;
|
||||||
|
|
||||||
|
plugins = {
|
||||||
|
gitsigns = {
|
||||||
|
enable = true;
|
||||||
|
settings.signs = {
|
||||||
|
add.text = "+";
|
||||||
|
change.text = "~";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nvim-autopairs.enable = true;
|
||||||
|
|
||||||
|
nvim-colorizer = {
|
||||||
|
enable = true;
|
||||||
|
userDefaultOptions.names = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
oil.enable = true;
|
||||||
|
|
||||||
|
trim = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
highlight = true;
|
||||||
|
ft_blocklist = [
|
||||||
|
"checkhealth"
|
||||||
|
"floaterm"
|
||||||
|
"lspinfo"
|
||||||
|
"neo-tree"
|
||||||
|
"TelescopePrompt"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
22
home/extra/neovim/plugins/efm.nix
Normal file
22
home/extra/neovim/plugins/efm.nix
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim.plugins = {
|
||||||
|
lsp.servers.efm = {
|
||||||
|
enable = true;
|
||||||
|
extraOptions.init_options = {
|
||||||
|
documentFormatting = true;
|
||||||
|
documentRangeFormatting = true;
|
||||||
|
hover = true;
|
||||||
|
documentSymbol = true;
|
||||||
|
codeAction = true;
|
||||||
|
completion = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp-format = {
|
||||||
|
enable = true;
|
||||||
|
lspServersToEnable = ["efm"];
|
||||||
|
};
|
||||||
|
|
||||||
|
efmls-configs.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
12
home/extra/neovim/plugins/floaterm.nix
Normal file
12
home/extra/neovim/plugins/floaterm.nix
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim.plugins.floaterm = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
width = 0.8;
|
||||||
|
height = 0.8;
|
||||||
|
|
||||||
|
title = "";
|
||||||
|
|
||||||
|
keymaps.toggle = "<leader>,";
|
||||||
|
};
|
||||||
|
}
|
||||||
20
home/extra/neovim/plugins/harpoon.nix
Normal file
20
home/extra/neovim/plugins/harpoon.nix
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
plugins.harpoon = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
keymapsSilent = true;
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
addFile = "<leader>a";
|
||||||
|
toggleQuickMenu = "<C-e>";
|
||||||
|
navFile = {
|
||||||
|
"1" = "<C-j>";
|
||||||
|
"2" = "<C-k>";
|
||||||
|
"3" = "<C-l>";
|
||||||
|
"4" = "<C-m>";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
33
home/extra/neovim/plugins/lsp.nix
Normal file
33
home/extra/neovim/plugins/lsp.nix
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
plugins = {
|
||||||
|
lsp = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
silent = true;
|
||||||
|
diagnostic = {
|
||||||
|
# Navigate in diagnostics
|
||||||
|
"<leader>k" = "goto_prev";
|
||||||
|
"<leader>j" = "goto_next";
|
||||||
|
};
|
||||||
|
|
||||||
|
lspBuf = {
|
||||||
|
gd = "definition";
|
||||||
|
gD = "references";
|
||||||
|
gt = "type_definition";
|
||||||
|
gi = "implementation";
|
||||||
|
K = "hover";
|
||||||
|
"<F2>" = "rename";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
servers = {
|
||||||
|
clangd.enable = true;
|
||||||
|
lua-ls.enable = true;
|
||||||
|
texlab.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
46
home/extra/neovim/plugins/lualine.nix
Normal file
46
home/extra/neovim/plugins/lualine.nix
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim.plugins.lualine = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
globalstatus = true;
|
||||||
|
|
||||||
|
# +-------------------------------------------------+
|
||||||
|
# | A | B | C X | Y | Z |
|
||||||
|
# +-------------------------------------------------+
|
||||||
|
sections = {
|
||||||
|
lualine_a = ["mode"];
|
||||||
|
lualine_b = ["branch"];
|
||||||
|
lualine_c = ["filename" "diff"];
|
||||||
|
|
||||||
|
lualine_x = [
|
||||||
|
"diagnostics"
|
||||||
|
|
||||||
|
# Show active language server
|
||||||
|
{
|
||||||
|
name.__raw = ''
|
||||||
|
function()
|
||||||
|
local msg = ""
|
||||||
|
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||||
|
local clients = vim.lsp.get_active_clients()
|
||||||
|
if next(clients) == nil then
|
||||||
|
return msg
|
||||||
|
end
|
||||||
|
for _, client in ipairs(clients) do
|
||||||
|
local filetypes = client.config.filetypes
|
||||||
|
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||||
|
return client.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return msg
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
icon = "";
|
||||||
|
color.fg = "#ffffff";
|
||||||
|
}
|
||||||
|
"encoding"
|
||||||
|
"fileformat"
|
||||||
|
"filetype"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
20
home/extra/neovim/plugins/markdown-preview.nix
Normal file
20
home/extra/neovim/plugins/markdown-preview.nix
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
plugins.markdown-preview = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
auto_close = false;
|
||||||
|
theme = "dark";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
files."after/ftplugin/markdown.lua".keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>m";
|
||||||
|
action = ":MarkdownPreview<cr>";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
22
home/extra/neovim/plugins/neo-tree.nix
Normal file
22
home/extra/neovim/plugins/neo-tree.nix
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>n";
|
||||||
|
action = ":Neotree action=focus reveal toggle<CR>";
|
||||||
|
options.silent = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
plugins.neo-tree = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
closeIfLastWindow = true;
|
||||||
|
window = {
|
||||||
|
width = 30;
|
||||||
|
autoExpandWidth = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
32
home/extra/neovim/plugins/startify.nix
Normal file
32
home/extra/neovim/plugins/startify.nix
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim.plugins.startify = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
custom_header = [
|
||||||
|
""
|
||||||
|
" ███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗"
|
||||||
|
" ████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║"
|
||||||
|
" ██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║"
|
||||||
|
" ██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║"
|
||||||
|
" ██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║"
|
||||||
|
" ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝"
|
||||||
|
];
|
||||||
|
|
||||||
|
# When opening a file or bookmark, change to its directory.
|
||||||
|
change_to_dir = false;
|
||||||
|
|
||||||
|
# By default, the fortune header uses ASCII characters, because they work for everyone.
|
||||||
|
# If you set this option to 1 and your 'encoding' is "utf-8", Unicode box-drawing characters will
|
||||||
|
# be used instead.
|
||||||
|
use_unicode = true;
|
||||||
|
|
||||||
|
lists = [{type = "dir";}];
|
||||||
|
files_number = 30;
|
||||||
|
|
||||||
|
skiplist = [
|
||||||
|
"flake.lock"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
17
home/extra/neovim/plugins/tagbar.nix
Normal file
17
home/extra/neovim/plugins/tagbar.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
plugins.tagbar = {
|
||||||
|
enable = true;
|
||||||
|
settings.width = 50;
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-g>";
|
||||||
|
action = ":TagbarToggle<cr>";
|
||||||
|
options.silent = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
33
home/extra/neovim/plugins/telescope.nix
Normal file
33
home/extra/neovim/plugins/telescope.nix
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
plugins.telescope = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
# Find files using Telescope command-line sugar.
|
||||||
|
"<leader>ff" = "find_files";
|
||||||
|
"<leader>fg" = "live_grep";
|
||||||
|
"<leader>b" = "buffers";
|
||||||
|
"<leader>fh" = "help_tags";
|
||||||
|
"<leader>fd" = "diagnostics";
|
||||||
|
|
||||||
|
# FZF like bindings
|
||||||
|
"<C-p>" = "git_files";
|
||||||
|
"<leader>p" = "oldfiles";
|
||||||
|
"<C-f>" = "live_grep";
|
||||||
|
};
|
||||||
|
|
||||||
|
settings.defaults = {
|
||||||
|
file_ignore_patterns = [
|
||||||
|
"^.git/"
|
||||||
|
"^.mypy_cache/"
|
||||||
|
"^__pycache__/"
|
||||||
|
"^output/"
|
||||||
|
"^data/"
|
||||||
|
"%.ipynb"
|
||||||
|
];
|
||||||
|
set_env.COLORTERM = "truecolor";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
26
home/extra/neovim/plugins/treesitter.nix
Normal file
26
home/extra/neovim/plugins/treesitter.nix
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim.plugins = {
|
||||||
|
treesitter = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
nixvimInjections = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
highlight.enable = true;
|
||||||
|
indent.enable = true;
|
||||||
|
};
|
||||||
|
folding = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
treesitter-refactor = {
|
||||||
|
enable = true;
|
||||||
|
highlightDefinitions = {
|
||||||
|
enable = true;
|
||||||
|
# Set to false if you have an `updatetime` of ~100.
|
||||||
|
clearOnCursorMove = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
hmts.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
77
home/extra/neovim/plugins/vimtex.nix
Normal file
77
home/extra/neovim/plugins/vimtex.nix
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
plugins.vimtex = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
view_method = "zathura";
|
||||||
|
|
||||||
|
quickfix_enabled = true;
|
||||||
|
quickfix_open_on_warning = false;
|
||||||
|
|
||||||
|
# Ignore undesired errors and warnings
|
||||||
|
quickfix_ignore_filters = [
|
||||||
|
"Underfull"
|
||||||
|
"Overfull"
|
||||||
|
"specifier changed to"
|
||||||
|
"Token not allowed in a PDF string"
|
||||||
|
];
|
||||||
|
|
||||||
|
# TOC settings
|
||||||
|
toc_config = {
|
||||||
|
name = "TOC";
|
||||||
|
layers = ["content" "todo"];
|
||||||
|
resize = true;
|
||||||
|
split_width = 50;
|
||||||
|
todo_sorted = false;
|
||||||
|
show_help = true;
|
||||||
|
show_numbers = true;
|
||||||
|
mode = 2;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
files."after/ftplugin/tex.lua".keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "m";
|
||||||
|
action = ":VimtexView<cr>";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
event = ["BufEnter" "BufWinEnter"];
|
||||||
|
pattern = "*.tex";
|
||||||
|
command = "set filetype=tex \"| VimtexTocOpen";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Folding
|
||||||
|
{
|
||||||
|
event = "FileType";
|
||||||
|
pattern = ["tex" "latex"];
|
||||||
|
callback.__raw = ''
|
||||||
|
function ()
|
||||||
|
vim.o.foldmethod = 'expr'
|
||||||
|
vim.o.foldexpr = 'vimtex#fold#level(v:lnum)'
|
||||||
|
vim.o.foldtext = 'vimtex#fold#text()'
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# Compile on initialization
|
||||||
|
{
|
||||||
|
event = "User";
|
||||||
|
pattern = "VimtexEventInitPost";
|
||||||
|
callback = "vimtex#compiler#compile";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cleanup on exit
|
||||||
|
{
|
||||||
|
event = "User";
|
||||||
|
pattern = "VimtexEventQuit";
|
||||||
|
command = "call vimtex#compiler#clean(0)";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
26
home/extra/neovim/todo.nix
Normal file
26
home/extra/neovim/todo.nix
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
programs.nixvim = {
|
||||||
|
highlight.Todo = {
|
||||||
|
fg = "Blue";
|
||||||
|
bg = "Yellow";
|
||||||
|
};
|
||||||
|
|
||||||
|
match.TODO = "TODO";
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-t>";
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require('telescope.builtin').live_grep({
|
||||||
|
default_text="TODO",
|
||||||
|
initial_mode="normal"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
options.silent = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
62
home/extra/neovimbak/default.nix
Normal file
62
home/extra/neovimbak/default.nix
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
{pkgs, ...}: let
|
||||||
|
treesitterWithGrammars = pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [
|
||||||
|
p.bash
|
||||||
|
p.comment
|
||||||
|
p.css
|
||||||
|
p.dockerfile
|
||||||
|
p.fish
|
||||||
|
p.gitattributes
|
||||||
|
p.gitignore
|
||||||
|
p.go
|
||||||
|
p.gomod
|
||||||
|
p.gowork
|
||||||
|
p.hcl
|
||||||
|
p.javascript
|
||||||
|
p.jq
|
||||||
|
p.json5
|
||||||
|
p.json
|
||||||
|
p.lua
|
||||||
|
p.make
|
||||||
|
p.markdown
|
||||||
|
p.nix
|
||||||
|
p.python
|
||||||
|
p.rust
|
||||||
|
p.toml
|
||||||
|
p.typescript
|
||||||
|
p.vue
|
||||||
|
p.yaml
|
||||||
|
]);
|
||||||
|
|
||||||
|
treesitter-parsers = pkgs.symlinkJoin {
|
||||||
|
name = "treesitter-parsers";
|
||||||
|
paths = treesitterWithGrammars.dependencies;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
programs.neovim = {
|
||||||
|
enable = true;
|
||||||
|
defaultEditor = true;
|
||||||
|
package = pkgs.neovim-unwrapped;
|
||||||
|
vimAlias = true;
|
||||||
|
coc.enable = false;
|
||||||
|
withNodeJs = true;
|
||||||
|
#package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default;
|
||||||
|
plugins = [
|
||||||
|
treesitterWithGrammars
|
||||||
|
];
|
||||||
|
};
|
||||||
|
home.file."./.config/nvim/" = {
|
||||||
|
source = ./nvim;
|
||||||
|
recursive = true;
|
||||||
|
};
|
||||||
|
home.file."./.config/nvim/lua/cnst/init.lua".text = ''
|
||||||
|
require("cnst.set")
|
||||||
|
require("cnst.remap")
|
||||||
|
vim.opt.runtimepath:append("${treesitter-parsers}")
|
||||||
|
'';
|
||||||
|
# Treesitter is configured as a locally developed module in lazy.nvim
|
||||||
|
# we hardcode a symlink here so that we can refer to it in our lazy config
|
||||||
|
home.file."./.local/share/nvim/nix/nvim-treesitter/" = {
|
||||||
|
recursive = true;
|
||||||
|
source = treesitterWithGrammars;
|
||||||
|
};
|
||||||
|
}
|
||||||
118
home/extra/neovimbak/nvim/lua/cnst/set.lua
Normal file
118
home/extra/neovimbak/nvim/lua/cnst/set.lua
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
-- Set <space> as the leader key
|
||||||
|
-- See `:help mapleader`
|
||||||
|
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
|
||||||
|
-- Set to true if you have a Nerd Font installed
|
||||||
|
vim.g.have_nerd_font = true
|
||||||
|
|
||||||
|
-- [[ Setting options ]]
|
||||||
|
-- See `:help vim.opt`
|
||||||
|
-- NOTE: You can change these options as you wish!
|
||||||
|
-- For more options, you can see `:help option-list`
|
||||||
|
|
||||||
|
-- Make line numbers default
|
||||||
|
vim.opt.number = true
|
||||||
|
-- You can also add relative line numbers, to help with jumping.
|
||||||
|
-- Experiment for yourself to see if you like it!
|
||||||
|
vim.opt.relativenumber = false
|
||||||
|
|
||||||
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||||
|
vim.opt.mouse = 'a'
|
||||||
|
|
||||||
|
-- Don't show the mode, since it's already in the status line
|
||||||
|
vim.opt.showmode = false
|
||||||
|
|
||||||
|
-- Sync clipboard between OS and Neovim.
|
||||||
|
-- Remove this option if you want your OS clipboard to remain independent.
|
||||||
|
-- See `:help 'clipboard'`
|
||||||
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
|
||||||
|
-- Enable break indent
|
||||||
|
vim.opt.breakindent = true
|
||||||
|
|
||||||
|
-- Save undo history
|
||||||
|
vim.opt.undofile = true
|
||||||
|
|
||||||
|
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||||
|
vim.opt.ignorecase = true
|
||||||
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
|
-- Keep signcolumn on by default
|
||||||
|
vim.opt.signcolumn = 'yes'
|
||||||
|
|
||||||
|
-- Decrease update time
|
||||||
|
vim.opt.updatetime = 250
|
||||||
|
|
||||||
|
-- Decrease mapped sequence wait time
|
||||||
|
-- Displays which-key popup sooner
|
||||||
|
vim.opt.timeoutlen = 300
|
||||||
|
|
||||||
|
-- Configure how new splits should be opened
|
||||||
|
vim.opt.splitright = true
|
||||||
|
vim.opt.splitbelow = true
|
||||||
|
|
||||||
|
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||||
|
-- See `:help 'list'`
|
||||||
|
-- and `:help 'listchars'`
|
||||||
|
vim.opt.list = true
|
||||||
|
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||||
|
|
||||||
|
-- Preview substitutions live, as you type!
|
||||||
|
vim.opt.inccommand = 'split'
|
||||||
|
|
||||||
|
-- Show which line your cursor is on
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
|
||||||
|
-- Minimal number of screen lines to keep above and below the cursor.
|
||||||
|
vim.opt.scrolloff = 10
|
||||||
|
|
||||||
|
-- [[ Basic Keymaps ]]
|
||||||
|
-- See `:help vim.keymap.set()`
|
||||||
|
|
||||||
|
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
||||||
|
vim.opt.hlsearch = true
|
||||||
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||||
|
|
||||||
|
-- Diagnostic keymaps
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
||||||
|
vim.keymap.set('n', '<leader>de', vim.diagnostic.open_float, { desc = 'Show [D]iagnostic [E]rror messages' })
|
||||||
|
vim.keymap.set('n', '<leader>dq', vim.diagnostic.setloclist, { desc = 'Open [D]iagnostic [Q]uickfix list' })
|
||||||
|
|
||||||
|
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||||
|
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||||
|
-- is not what someone will guess without a bit more experience.
|
||||||
|
--
|
||||||
|
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
||||||
|
-- or just use <C-\><C-n> to exit terminal mode
|
||||||
|
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||||
|
|
||||||
|
-- TIP: Disable arrow keys in normal mode
|
||||||
|
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||||
|
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||||
|
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||||
|
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||||
|
|
||||||
|
-- Keybinds to make split navigation easier.
|
||||||
|
-- Use CTRL+<hjkl> to switch between windows
|
||||||
|
--
|
||||||
|
-- See `:help wincmd` for a list of all window commands
|
||||||
|
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||||
|
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||||
|
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||||
|
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||||
|
|
||||||
|
-- [[ Basic Autocommands ]]
|
||||||
|
-- See `:help lua-guide-autocommands`
|
||||||
|
|
||||||
|
-- Highlight when yanking (copying) text
|
||||||
|
-- Try it with `yap` in normal mode
|
||||||
|
-- See `:help vim.highlight.on_yank()`
|
||||||
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
|
desc = 'Highlight when yanking (copying) text',
|
||||||
|
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank()
|
||||||
|
end,
|
||||||
|
})
|
||||||
@@ -106,7 +106,7 @@ return {
|
|||||||
lsp.configure("nil_ls", {
|
lsp.configure("nil_ls", {
|
||||||
settings = {
|
settings = {
|
||||||
["nil"] = {
|
["nil"] = {
|
||||||
formatting = { command = { "nixpkgs-fmt" } },
|
formatting = { command = { "alejandra" } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -118,7 +118,7 @@ return {
|
|||||||
singe_file_support = true,
|
singe_file_support = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
lsp.configure("volar", {
|
lsp.configure("tsserver", {
|
||||||
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue", "json" },
|
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue", "json" },
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ return {
|
|||||||
dependencies = { "nvim-tree/nvim-web-devicons", optional = true },
|
dependencies = { "nvim-tree/nvim-web-devicons", optional = true },
|
||||||
opts = {
|
opts = {
|
||||||
options = {
|
options = {
|
||||||
theme = "dracula",
|
theme = "gruvbox-material",
|
||||||
},
|
},
|
||||||
sections = {
|
sections = {
|
||||||
lualine_a = { "mode" },
|
lualine_a = { "mode" },
|
||||||
Reference in New Issue
Block a user