forked from fabian/nix
		
	
		
			
				
	
	
		
			109 lines
		
	
	
	
		
			3.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			109 lines
		
	
	
	
		
			3.3 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{
 | 
						|
  config,
 | 
						|
  lib,
 | 
						|
  pkgs,
 | 
						|
  ...
 | 
						|
}:
 | 
						|
with lib; let
 | 
						|
  cfg = config.local.programs.neovim;
 | 
						|
in {
 | 
						|
  options.local.programs.neovim = {
 | 
						|
    enable = mkEnableOption "Neovim settings";
 | 
						|
  };
 | 
						|
  config = mkIf cfg.enable {
 | 
						|
    programs.neovim = {
 | 
						|
      enable = true;
 | 
						|
      viAlias = true;
 | 
						|
      vimAlias = true;
 | 
						|
      defaultEditor = true;
 | 
						|
 | 
						|
      extraConfig = ''
 | 
						|
        set nobackup
 | 
						|
        set showmatch               " show matching
 | 
						|
        set hlsearch                " highlight search
 | 
						|
        set incsearch               " incremental search
 | 
						|
        set tabstop=4               " number of columns occupied by a tab
 | 
						|
        set softtabstop=4           " see multiple spaces as tabstops so <BS> does the right thing
 | 
						|
        set shiftwidth=4            " width for autoindents
 | 
						|
        set autoindent              " indent a new line the same amount as the line just typed
 | 
						|
        set number                  " add line numbers
 | 
						|
        set wildmode=longest,list   " get bash-like tab completions
 | 
						|
        set cc=80                   " set an 80 column border for good coding style
 | 
						|
        filetype plugin indent on   " allow auto-indenting depending on file type
 | 
						|
        syntax on                   " syntax highlighting
 | 
						|
        set mouse=a                 " enable mouse click
 | 
						|
        set clipboard=unnamedplus   " using system clipboard
 | 
						|
        filetype plugin on
 | 
						|
        set cursorline              " highlight current cursorline
 | 
						|
        set ttyfast                 " Speed up scrolling in Vim
 | 
						|
        set noswapfile              " disable creating swap file
 | 
						|
      '';
 | 
						|
 | 
						|
      plugins = with pkgs.vimPlugins; [
 | 
						|
        barbar-nvim
 | 
						|
        nvim-web-devicons
 | 
						|
        vim-nix
 | 
						|
        vim-visual-multi
 | 
						|
        {
 | 
						|
          plugin = nvim-tree-lua;
 | 
						|
          type = "lua";
 | 
						|
          config = ''
 | 
						|
            require("nvim-tree").setup({
 | 
						|
              renderer = {
 | 
						|
                icons = {
 | 
						|
                  show = {
 | 
						|
                    file = true,
 | 
						|
                    folder = true,
 | 
						|
                    folder_arrow = true,
 | 
						|
                    git = true,
 | 
						|
                  },
 | 
						|
                  glyphs = {
 | 
						|
                    git = {
 | 
						|
                      unstaged = "",
 | 
						|
                      staged = "",
 | 
						|
                      unmerged = "",
 | 
						|
                      renamed = "",
 | 
						|
                      untracked = "",
 | 
						|
                      deleted = "",
 | 
						|
                      ignored = "",
 | 
						|
                    },
 | 
						|
                  },
 | 
						|
                },
 | 
						|
              },
 | 
						|
              view = {
 | 
						|
                width = 30,
 | 
						|
                side = 'left',
 | 
						|
              },
 | 
						|
              sync_root_with_cwd = true, --fix to open cwd with tree
 | 
						|
              respect_buf_cwd = true,
 | 
						|
              update_cwd = true,
 | 
						|
              update_focused_file = {
 | 
						|
                enable = true,
 | 
						|
                update_cwd = true,
 | 
						|
                update_root = true,
 | 
						|
              },
 | 
						|
            })
 | 
						|
 | 
						|
            vim.g.nvim_tree_respect_buf_cwd = 1
 | 
						|
 | 
						|
            -- use g? for bindings help while in tree
 | 
						|
          '';
 | 
						|
        }
 | 
						|
        {
 | 
						|
          plugin = gruvbox-nvim;
 | 
						|
          type = "lua";
 | 
						|
          config = ''
 | 
						|
            require("gruvbox").setup({
 | 
						|
              contrast = "high",
 | 
						|
            })
 | 
						|
            vim.o.background = "dark"
 | 
						|
            vim.cmd([[colorscheme gruvbox]])
 | 
						|
          '';
 | 
						|
        }
 | 
						|
      ];
 | 
						|
    };
 | 
						|
    home.sessionVariables = {
 | 
						|
      "EDITOR" = mkForce "neovim";
 | 
						|
    };
 | 
						|
  };
 | 
						|
}
 |