{ config, pkgs, lib, ... }:
{
imports = [
../xdg.nix
./ui.nix
./editing.nix
./keymap.nix
./lang.nix
./lsp.nix
];
programs.neovim = {
enable = true;
extraConfig = ''
<<<modules/home/nvim-config>>>
'';
plugins = with pkgs; with vimPlugins; [
plenary-nvim
nvim-web-devicons
<<<modules/home/nvim-plugins>>>
];
};
appDefaultForMimes."nvim.desktop" = "text/plain";
<<<modules/home/nvim-main>>>
}
Set space as leader
let g:mapleader = ' '
Use return to enter command mode: it's easier to press than :
nnoremap <cr> :
vnoremap <cr> :
set mouse=a " Enable mouse
set lazyredraw " Use lazy redraw
set undofile " Enable persistent undo
set hidden " Allow buffers in background
set ignorecase " Enable case insensitive search
set smartcase " when using uppercase make case sensitive
set incsearch " Show search results while typing
Use telescope as fuzzy finder
telescope-file-browser-nvim
telescope-fzf-native-nvim
telescope-symbols-nvim
{
plugin = telescope-nvim;
type = "lua";
config = ''
<<<modules/home/nvim-telescope>>>
'';
}
local telescope = require "telescope"
telescope.load_extension("file_browser")
telescope.load_extension("projects")
telescope.load_extension("fzf")
-- telescope.load_extension("termfinder")
Git easy with Magit Lazygit
local lazygit = require"toggleterm.terminal".Terminal:new {
cmd = "lazygit",
hidden = true,
count = 0,
direction = "tab",
on_open = function(term)
term.old_laststatus = vim.opt_local.laststatus
vim.opt_local.laststatus = 0
vim.opt_local.signcolumn = "no"
pcall(vim.api.nvim_buf_del_keymap, term.bufnr, "t", "<esc>")
end,
on_close = function(term)
vim.opt_local.laststatus = term.old_laststatus
end
}
function lazygit_toggle()
lazygit:toggle()
end
vim.api.nvim_create_user_command("Lazygit", lazygit_toggle, {})
Use NeoVim remote to open git message edit
home.packages = with pkgs; [
neovim-remote
];
let $GIT_EDITOR = 'nvr -cc split --remote-wait'
autocmd FileType gitcommit,gitrebase,gitconfig set bufhidden=delete
Show git signs
{
plugin = gitsigns-nvim;
type = "lua";
config = ''require"gitsigns".setup()'';
}
set spell
set spelllang=en,it " Define spelling dictionaries
set complete+=kspell " Add spellcheck options for autocomplete
set spelloptions=camel " Treat parts of camelCase words as separate words
{
plugin = project-nvim;
type = "lua";
config = ''require"project_nvim".setup()'';
}
A collection of small useful plugins
{
plugin = mini-nvim;
type = "lua";
config = ''
<<<mini-nvim>>>
'';
}