Skip to content

Instantly share code, notes, and snippets.

@PoSayDone
Created November 22, 2023 06:44
Show Gist options
  • Save PoSayDone/089b4c5939a9b53195849b80e8ea09d0 to your computer and use it in GitHub Desktop.
Save PoSayDone/089b4c5939a9b53195849b80e8ea09d0 to your computer and use it in GitHub Desktop.
nixvim configs
{ pkgs
, inputs
, config
, ...
}: {
imports = [ inputs.nixvim.homeManagerModules.nixvim ];
programs.neovim = {
defaultEditor = true;
};
programs.nixvim = {
enable = true;
package = pkgs.neovim-unwrapped;
extraPlugins = with pkgs.vimPlugins; [
vim-tpipeline
];
options = {
clipboard="unnamedplus";
number = true;
relativenumber = false;
undodir = "./undo";
undofile = true;
fillchars = {eob = " ";};
tabstop = 4;
shiftwidth = 4;
expandtab = false;
wrap=false;
laststatus = 3;
};
colorschemes.base16.enable = true;
colorschemes.base16.customColorScheme = {
base00 = "NONE";
base01 = "NONE";
base02 = "#3e4451";
base03 = "#6c7891";
base04 = "#565c64";
base05 = "#abb2bf";
base06 = "#9a9bb3";
base07 = "#c5c8e6";
base08 = "#f38ba8";
base09 = "#fab387";
base0A = "#f9e2af";
base0B = "#a6e3a1";
base0C = "#94e2d5";
base0D = "#89b4fa";
base0E = "#cba6f7";
base0F = "#f2cdcd";
};
globals = {
mapleader = " ";
};
plugins = {
barbecue.enable = true;
nvim-colorizer.enable = true;
gitsigns.enable = true;
indent-blankline.enable = true;
surround.enable = true;
bufferline.enable = true;
nvim-autopairs.enable = true;
tmux-navigator.enable = true;
lsp-format.enable = true;
lint = {
enable = true;
lintersByFt = {
text = ["vale"];
json = ["jsonlint"];
markdown = ["vale"];
rst = ["vale"];
ruby = ["ruby"];
janet = ["janet"];
inko = ["inko"];
clojure = ["clj-kondo"];
dockerfile = ["hadolint"];
terraform = ["tflint"];
typscriptreact = ["prettier_eslint"];
};
};
lualine = {
enable = true;
theme = "base16";
componentSeparators = {
left = "";
right = "";
};
sectionSeparators = {
left = "";
right = "";
};
inactiveSections = {
lualine_a = null;
lualine_b = null;
lualine_c = null;
lualine_x = null;
lualine_y = null;
lualine_z = null;
};
sections = {
lualine_a = ["mode"];
lualine_b = [ "filename" "branch" ];
lualine_c = [ "fileformat" ];
lualine_x = [ "progress" ];
lualine_y = [ "filetype" ];
lualine_z = [ "location" ];
};
};
telescope = {
enable = true;
keymaps = {
"<leader>ff" = "find_files";
};
};
nvim-tree = {
enable = true;
filters.custom = [
".git"
];
};
nix.enable = true;
zig.enable = true;
emmet.enable = true;
treesitter = {
enable = true;
nixGrammars = true;
};
lsp = {
enable = true;
servers = {
clangd.enable = true;
rnix-lsp.enable = true;
rust-analyzer.enable = true;
pyright.enable = true;
zls.enable = true;
gopls.enable = true;
elixirls.enable = true;
eslint.enable = true;
tsserver.enable = true;
};
};
lspkind = {
enable = true;
cmp.ellipsisChar = "...";
cmp.menu = {
buffer = "[Buffer]";
nvim_lsp = "[LSP]";
luasnip = "[LuaSnip]";
nvim_lua = "[Lua]";
latex_symbols = "[Latex]";
};
cmp.after = ''
function(entry, vim_item, kind)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. strings[1] .. " "
kind.menu = " " .. strings[2]
return kind
end
'';
};
nvim-cmp = {
enable = true;
sources = [{ name = "nvim_lsp"; }];
mappingPresets = [ "insert" ];
mapping = {
"<CR>" = "cmp.mapping.confirm({ select = true })";
};
formatting.fields = [ "kind" "abbr" "menu" ];
};
lsp-lines.enable = true;
};
keymaps = [
{
key = "<Tab>";
action = ":bnext<CR>";
options = {
silent = true;
};
}
{
key = "<S-Tab>";
action = ":bprev<CR>";
options = {
silent = true;
};
}
{
key = "<C-n>";
action = ":NvimTreeToggle<CR>";
options = {
silent = true;
};
}
{
key = "<C-s>";
action = ":w<CR>";
options = {
silent = true;
};
}
{
key = "<C-h>";
action = "<C-w>h";
options = {
silent = true;
};
}
{
key = "<C-j>";
action = "<C-w>j";
options = {
silent = true;
};
}
{
key = "<leader>x";
action = ":bd<CR>";
options = {
silent = true;
};
}
{
key = "<";
action = "< gv";
mode = ["v"];
options = {
silent = true;
};
}
{
key = ">";
action = "> gv";
mode = ["v"];
options = {
silent = true;
};
}
{
key = "<Esc>";
action = ":noh<CR>";
options = {
silent = true;
};
}
];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment