Enable neovim through home-manager
- We need to set the default editor to just "nvim" not a particular path, as
this allows us to override nvim in our home
- Add the mapleader bind to the start of init.vim
- As the leader is interpreted whenever we make a keybind, we must have it at
the start or it won't be respected for some of our keybinds (but will be for
others)
- Package the scrollbar plugin and install it
- Setup configs for stuff like treesitter, theme, COC, scrollbar etc.
- Add git capabilities to neovim
- Install fugitive, gitgutter and git-conflict, along with some other basic git
stuff
- Allow mouse control in neovim
diff --git a/modules/neovim/tree-sitter/default.nix b/modules/neovim/tree-sitter/default.nix
new file mode 100644
index 0000000..d4b96de
--- /dev/null
+++ b/modules/neovim/tree-sitter/default.nix
@@ -0,0 +1,20 @@
+{
+ pkgs,
+ lib,
+ ...
+}: {
+ programs.neovim = {
+ plugins = with pkgs.vimPlugins; [
+ (nvim-treesitter.withPlugins (plugins:
+ (builtins.attrValues plugins)
+ ++ (with pkgs.vimPlugins; [
+ nvim-ts-rainbow
+ nvim-treesitter-refactor
+ ])))
+ nvim-treesitter-context
+ ];
+ extraConfig = ''
+ source ${./setup.lua}
+ '';
+ };
+}
diff --git a/modules/neovim/tree-sitter/setup.lua b/modules/neovim/tree-sitter/setup.lua
new file mode 100644
index 0000000..b281245
--- /dev/null
+++ b/modules/neovim/tree-sitter/setup.lua
@@ -0,0 +1,82 @@
+require('nvim-treesitter.configs').setup {
+ highlight = {
+ enable = true,
+ additional_vim_regex_highlighting = {'org'},
+ },
+ rainbow = {
+ enable = true,
+ extended_mode = true,
+ max_file_lines = nil,
+ colors = {
+ "#e06c75",
+ "#e5c07b",
+ "#98c379",
+ "#56b6c2",
+ "#61afef",
+ "#c678dd",
+ },
+ termcolors = {
+ "168",
+ "180",
+ "114",
+ "73",
+ "75",
+ "176",
+ },
+ },
+ incremental_selection = {
+ enable = true,
+ keymaps = {
+ init_selection = "gnn",
+ node_incremental = "grn",
+ scope_incremental = "grc",
+ node_decremental = "grm",
+ },
+ },
+ indent = {
+ enable = true,
+ },
+ refactor = {
+ highlight_definitions = {
+ enable = true,
+ clear_on_cursor_move = true,
+ },
+ smart_rename = {
+ enable = true,
+ keymaps = {
+ smart_rename = "<leader>fr",
+ },
+ },
+ navigation = {
+ enable = true,
+ keymaps = {
+ goto_definition = "<leader>gd",
+ list_definitions = "<leader>gD",
+ list_definitions_toc = "<leader>ggD",
+ goto_next_usage = "<leader>g]",
+ goto_previous_usage = "<leader>g[",
+ },
+ },
+
+ },
+}
+
+require('treesitter-context').setup{
+ enable = true,
+ trim_scope = 'outer',
+ patterns = {
+ default = {
+ 'class',
+ 'function',
+ 'method',
+ 'for',
+ 'while',
+ 'if',
+ 'switch',
+ 'case',
+ },
+ },
+ mode = 'topline'
+}
+
+vim.cmd[[hi! TreesitterContext guibg=#313640 ctermbg=237]]