From 9ad9e6d7c3e426b156c8faa4cec51ef798701e38 Mon Sep 17 00:00:00 2001 From: Alejandro Angulo Date: Sun, 25 Sep 2022 11:01:06 -0700 Subject: [PATCH] Started experimenting with neovim --- flake.lock | 13 +++--- flake.nix | 2 +- users/alejandro/home.nix | 3 +- users/alejandro/neovim.nix | 95 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 users/alejandro/neovim.nix diff --git a/flake.lock b/flake.lock index 981f41d..869c458 100644 --- a/flake.lock +++ b/flake.lock @@ -23,17 +23,18 @@ }, "nixpkgs": { "locked": { - "lastModified": 1663760840, - "narHash": "sha256-ym5Iycs5H4cOaLfE2/vC0tsLp8XuBJQIHGV8/uXSy8M=", + "lastModified": 1664017330, + "narHash": "sha256-919WZKBTxFdTkzIK6uJXE7hwSPQb7e/ekybxxWaotR4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9bdbbaa634aa666eb6a27096bdcb991c59181244", + "rev": "fde244a8c7655bc28616864e2290ad9c95409c2c", "type": "github" }, "original": { - "id": "nixpkgs", - "ref": "nixos-22.05", - "type": "indirect" + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "root": { diff --git a/flake.nix b/flake.nix index d4bf63a..0d8fd35 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "My Nix Configuration"; inputs = { - nixpkgs.url = "nixpkgs/nixos-22.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; home-manager.url = "github:nix-community/home-manager/release-22.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; diff --git a/users/alejandro/home.nix b/users/alejandro/home.nix index fd01eb8..50701bf 100644 --- a/users/alejandro/home.nix +++ b/users/alejandro/home.nix @@ -12,7 +12,8 @@ ./rofi.nix ./sway/sway.nix ./tmux.nix - ./vim/vim.nix + #./vim/vim.nix + ./neovim.nix ./zsh.nix ]; diff --git a/users/alejandro/neovim.nix b/users/alejandro/neovim.nix new file mode 100644 index 0000000..20301e5 --- /dev/null +++ b/users/alejandro/neovim.nix @@ -0,0 +1,95 @@ +{ + config, + pkgs, + ... +}: { + home.packages = with pkgs; [fzf fd]; + + programs.neovim = { + enable = true; + withNodeJs = true; + withPython3 = true; + extraPython3Packages = ps: with ps; [black isort flake8 ipdb]; + #extraPackages = with pkgs; []; + plugins = with pkgs.vimPlugins; [ + # tree-sitter (code parser) + (nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars)) + + # Eye candy + nvim-web-devicons + base16-vim + + # Telescope (fuzzy finding) + { + plugin = telescope-nvim; + config = '' + nnoremap ff lua require('telescope.builtin').find_files() + nnoremap fg lua require('telescope.builtin').live_grep() + nnoremap fb lua require('telescope.builtin').buffers() + nnoremap fh lua require('telescope.builtin').help_tags() + ''; + } + { + plugin = telescope-file-browser-nvim; + type = "lua"; + config = '' + vim.api.nvim_set_keymap( + "n", + "fb", + ":Telescope file_browser", + { noremap = true } + ) + require("telescope").load_extension("file_browser") + ''; + } + { + plugin = telescope-coc-nvim; + type = "lua"; + config = '' + require("telescope").setup({ + extensions = { + coc = { + prefer_locations = true; + } + } + }) + require("telescope").load_extension("coc") + + vim.api.nvim_set_keymap( + "n", + "coc", + ":Telescope coc", + { noremap = true } + ) + ''; + } + + # tmux integration + tmux-navigator + ]; + + coc = { + enable = true; + settings = '' + { + coc.preferences.formatOnSaveFiletypes": [ + "*" + ], + python.formatting.provider": "black" + } + ''; + }; + + extraConfig = '' + let mapleader = "'" + + " Colorscheme + if !exists('g:colors_name') || g:colors_name != 'base16-darktooth' + set background=dark + let base16colorspace=256 + colorscheme base16-darktooth + hi Normal ctermbg=NONE guibg=NONE + endif + ''; + }; +}