Files
neovim/config.nix

327 lines
6.7 KiB
Nix

{ pkgs, pkgs-unstable, inputs, ... }:
{
colorschemes.tokyonight.enable = true;
opts = {
number = true;
relativenumber = true;
# Show whitespace
list = true;
listchars.__raw = "{ tab = '» ', trail = '·', nbsp = '', lead = '·'}";
# Start scrolling when the cursor is X lines away from edge
scrolloff = 10;
ignorecase = true;
smartcase = true;
cindent = true;
# Same as default, but without "0#,", which prevents typing "#"
# from going to the start of the line
cinkeys = "0{,0},0),0],:,!^F,o,O,e";
signcolumn = "yes";
};
clipboard.providers.wl-copy.enable = true;
clipboard.providers.xclip.enable = true;
plugins = {
dashboard = {
enable = true;
settings = {
theme = "hyper";
config = {
header = [
" "
" "
" "
" "
" "
" "
""
];
shortcut = [
{
action = {
__raw = "function(path) vim.cmd('Telescope find_files') end";
};
desc = "Find Files";
key = "f";
icon = " ";
}
];
};
};
};
telescope = {
enable = true;
keymaps = {
"<C-f>" = "live_grep";
"<C-p>" = "git_files";
"<C-o>" = "find_files no_ignore=true";
};
settings = {
defaults = {
file_ignore_patterns = [
"^.git/"
"^target/"
"^dist/"
];
};
};
extensions = {
fzf-native = {
enable = true;
settings = {
fuzzy = true;
override_file_sorter = true;
override_generic_sorter = true;
};
};
};
};
# Needed for telescope
web-devicons.enable = true;
lualine = {
enable = true;
settings = {
options = {
component_separators = "|";
section_separators = "";
globalstatus = true;
};
};
};
neo-tree = {
enable = true;
closeIfLastWindow = true;
filesystem = {
filteredItems = {
visible = true;
hideDotfiles = false;
hideGitignored = false;
};
};
};
neogit.enable = true;
gitsigns.enable = true;
tiny-inline-diagnostic = {
enable = true;
settings = {
options = {
show_source.enabled = true;
settings.auto_start = true;
};
};
};
coq-nvim = {
enable = true;
installArtifacts = true;
luaConfig.post = ''
vim.g.coq_settings = {
keymap = { jump_to_mark = "" },
}
'';
};
nvim-autopairs.enable = true;
comment.enable = true;
sleuth.enable = true;
rustaceanvim = {
enable = true;
settings = {
server = {
cmd = [ "${pkgs-unstable.rust-analyzer}/bin/rust-analyzer" ];
};
};
};
mkdnflow = {
enable = true;
mappings = {
MkdnEnter = {
key = "<CR>";
modes = [ "n" "v" "i" ];
};
};
};
lsp = {
enable = true;
keymaps.diagnostic = {
"<leader>j" = "goto_next";
"<leader>k" = "goto_prev";
};
servers = {
typos_lsp.enable = true;
markdown_oxide.enable = true;
ltex.enable = true;
# haskell-language-server
hls = {
enable = true;
installGhc = false;
};
};
};
};
extraPlugins = [
(pkgs.vimUtils.buildVimPlugin {
name = "hml";
src = inputs.hml;
})
(pkgs.vimUtils.buildVimPlugin {
name = "typst-preview";
src = inputs.typst-preview;
})
pkgs.vimPlugins.haskell-tools-nvim
];
extraConfigLua = ''
require("hml").setup()
require("typst-preview").setup()
'';
extraPackages = with pkgs; [
# Telescope
ripgrep
# typst-preview
typst
poppler-utils # (pdfinfo)
];
autoCmd = [
{
# Reset cinkeys when editing c/c++ files
command = "setlocal cinkeys&";
pattern = [
"*.c"
"*.h"
"*.cpp"
"*.hpp"
];
event = [
"BufEnter"
"BufWinEnter"
];
}
];
keymaps = [
{
action = "<Cmd>nohl<CR>";
key = "<Esc>";
mode = [ "n" ];
}
{
action = "<Cmd>Dashboard<CR>";
key = "<leader>d";
}
{
action = "<Cmd>Neotree toggle right<CR>";
key = "<leader>f";
}
{
action = "<Cmd>Neogit<CR>";
key = "<C-g>";
}
{
action = "<Cmd>sp<CR><Cmd>wincmd j<CR><Cmd>term<CR>15<C-w>-i";
key = "<leader>t";
}
{
# Exit terminal mode
action = "<C-\\><C-n>";
key = "<C-e>";
mode = [ "t" ];
}
{
action = "<Cmd>vsplit<CR>";
key = "<leader>v";
}
{
action = "<Cmd>split<CR>";
key = "<leader>h";
}
{
action = "<Cmd>tabnew<CR>";
key = "<leader>n";
}
{
action = "<Cmd>tabn<CR>";
key = "<C-]>";
}
{
action = "<Cmd>tabp<CR>";
key = "<C-[>";
}
{
action = "<C-\\><C-n><Cmd>tabn<CR>";
key = "<C-]>";
mode = [ "t" ];
}
{
action = "<C-\\><C-n><Cmd>tabp<CR>";
key = "<C-[>";
}
{
action = "<Cmd>lua require(\"typst-preview\").start()<CR>";
key = "<C-m>s";
}
{
action = "<Cmd>lua require(\"typst-preview\").stop()<CR>";
key = "<C-m>q";
}
{
action = "<Cmd>lua require(\"typst-preview\").prev_page()<CR>";
key = "<C-m>k";
}
{
action = "<Cmd>lua require(\"typst-preview\").next_page()<CR>";
key = "<C-m>j";
}
] ++ (
builtins.concatMap (k: [
{
action = "<Cmd>wincmd ${k}<CR>";
key = "<C-${k}>";
}
{
action = "<C-\\><C-n><Cmd>wincmd ${k} <CR>";
key = "<C-${k}>";
mode = [ "t" ];
}
]) ["h" "j" "k" "l"]
);
}