nix-dotfiles/modules/hm/vim.nix

238 lines
5.3 KiB
Nix

{ pkgs, ... }:
let vp = pkgs.vimPlugins; in {
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
plugins = [
# # Git related plugins
# vp.fugitive
# vp.rhubarb
vp.gitgutter
# vp.lsp-zero-nvim
# vp.nvim-cmp
# vp.cmp-nvim-lsp
# vp.nvim-lspconfig
{
plugin = vp.nvim-surround;
type = "lua";
config = ''require("nvim-surround").setup({})'';
}
{
plugin = vp.autoclose-nvim;
type = "lua";
config = ''
require("autoclose").setup({})
'';
}
vp.telescope-fzf-native-nvim
{
plugin = vp.telescope-nvim;
type = "lua";
config = builtins.readFile ./nvim/telescope-config.lua;
}
# Better UI for input and selection
vp.dressing-nvim
# # Tree view
# {
# plugin = vp.chadtree;
# type = "lua";
# config = ''
# local chadtree = require("chadtree")
#
# local chadtree_settings = { }
# vim.api.nvim_set_var("chadtree_settings", chadtree_settings)
#
# vim.keymap.set({ "n", "v" }, "<leader>v", "<cmd>CHADopen<CR>", { desc = "Toggle file tree" })
# '';
# }
vp.cmp-buffer # source for text in buffer
vp.cmp-path # source for file system path
vp.luasnip
vp.cmp_luasnip
vp.friendly-snippets
{
plugin = vp.nvim-cmp;
type = "lua";
config = builtins.readFile ./nvim/nvim-cmp-config.lua;
}
# Undo tree
{
plugin = vp.undotree;
type = "lua";
config = ''
vim.keymap.set({ "n", "v" }, "<leader>u",
vim.cmd.UndotreeToggle, { desc = "Toggle undo tree" })
'';
}
vp.markdown-preview-nvim
# # Detect tabstop and shiftwidth automatically
# vp.sleuth
# LSP
# fidget moving while LSP is working
{
plugin = vp.fidget-nvim;
type = "lua";
config = ''require("fidget").setup({})'';
}
vp.cmp-nvim-lsp
vp.lsp-format-nvim
{
plugin = vp.nvim-lspconfig;
type = "lua";
config = builtins.readFile ./nvim/nvim-lspconfig-config.lua;
}
# Cool color scheme
{
plugin = vp.nightfox-nvim;
config = "colorscheme nightfox";
}
# Set lualine as statusline
{
plugin = vp.lualine-nvim;
config = ''
require("lualine").setup({
options = {
icons_enabled = false,
theme = "nightfox",
component_separators = "|",
section_separators = "",
},
})
'';
type = "lua";
}
# # Add indentation guides even on blank lines
# {
# # See `:help ibl`
# plugin = vp.indent-blankline-nvim;
# config = ''
# require("ibl").setup({})
# '';
# type = "lua";
# }
# "gcc" or "gcb" to comment visual regions/lines
{
plugin = vp.comment-nvim;
config = ''
require("Comment").setup({})
'';
type = "lua";
}
# vp.nvim-treesitter-textobjects
# vp.nvim-treesitter
# Highlighting
{
plugin = vp.nvim-colorizer-lua;
type = "lua";
config = ''
local colorizer = require ("colorizer")
colorizer.setup {
css = true,
mode = "background",
tailwind = true,
}
--[[
require("colorizer").attach_to_buffer(0, { mode = "background", css = true})
require("colorizer").detach_from_buffer(0, { mode = "virtualtext", css = true})
]]--
'';
}
# Formatting
{
plugin = vp.conform-nvim;
type = "lua";
config = ''
require("conform").setup({
formatters_by_ft = {
-- lua = { "stylua" }
}
})
'';
}
];
# settings = { ignorecase = true; };
# coc.enable = true;
# extraConfig = ''
# let g:airline_powerline_fonts = 1
# '';
extraLuaConfig = ''
-- Setup
local o = vim.o
local g = vim.g
local opt = vim.opt
-- Font
o.guifont = "FiraCode Nerd Font Mono 10"
-- Status bar
o.laststatus = 3
o.showmode = false
-- Clipboard
-- o.clipboard = "unnamedplus"
-- Cursor
o.cursorline = true
o.cursorlineopt = "number"
-- Indenting
o.expandtab = true
o.shiftwidth = 2
o.smartindent = true
o.tabstop = 2
o.softtabstop = 2
-- Search
o.ignorecase = true
o.smartcase = true
-- Mouse
o.mouse = "a"
-- Numbers
o.number = true
-- disable nvim intro
-- opt.shortmess:append "sI"
-- Symbols
o.signcolumn = "yes"
o.splitbelow = true
o.splitright = true
o.timeoutlen = 400
o.undofile = true
-- interval for writing swap file to disk, also used by gitsigns
o.updatetime = 250
-- go to previous/next line with h,l,left arrow and right arrow
-- when cursor reaches end/beginning of line
opt.whichwrap:append "<>[]hl"
g.mapleader = " "
'';
};
}