diff --git a/modules/workstation/home-manager/default.nix b/modules/workstation/home-manager/default.nix index 448681d..c3cb2ab 100644 --- a/modules/workstation/home-manager/default.nix +++ b/modules/workstation/home-manager/default.nix @@ -23,7 +23,6 @@ in imports = [ ./desktop ./development - ./neovim ./fish.nix ./termux.nix ./gpg.nix diff --git a/modules/workstation/home-manager/development/default.nix b/modules/workstation/home-manager/development/default.nix index e8ced3d..b14e606 100644 --- a/modules/workstation/home-manager/development/default.nix +++ b/modules/workstation/home-manager/development/default.nix @@ -31,7 +31,7 @@ with lib; defaultBranch = "main"; }; core = { - editor = "${pkgs.neovim}/bin/nvim"; + editor = "${pkgs.helix}/bin/hx"; }; }; }; diff --git a/modules/workstation/home-manager/neovim/default.nix b/modules/workstation/home-manager/neovim/default.nix deleted file mode 100644 index f3c91ac..0000000 --- a/modules/workstation/home-manager/neovim/default.nix +++ /dev/null @@ -1,167 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; -{ - options.desktop.enableNeovim = mkOption { - type = types.bool; - default = true; - example = false; - description = '' - Whether to use Neovim and its config. - ''; - }; - - config.programs.neovim = mkIf config.desktop.enableNeovim { - enable = true; - - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - - extraConfig = '' - luafile ${./luaconfig/settings.lua} - luafile ${./luaconfig/keybindings.lua} - luafile ${./luaconfig/lspconfig.lua} - ''; - - extraPackages = with pkgs; [ - nixfmt - nil - ripgrep - entr - ]; - - plugins = with pkgs.vimPlugins; [ - - # Theming - { - plugin = onenord-nvim; - type = "lua"; - config = '' - require('onenord').setup() - ''; - } - { - plugin = lualine-nvim; - type = "lua"; - config = '' - require('lualine').setup() - ''; - } - vim-devicons - - # Utility plugins - { - plugin = nerdtree; - type = "lua"; - config = '' - vim.g.NERDTreeShowHidden = 1 - - vim.keymap.set('n', '', ':NERDTreeToggle', { desc = 'Toogle NERDTree pane' }) - vim.keymap.set('n', '', ':NERDTreeFind', { desc = 'Search file in NERDTree' }) - vim.keymap.set('n', '', ':NERDTreeFocus', { desc = 'Focus on the NERDTreePane' }) - - -- Keep the same NERDTree pane on each window - vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*", command = "if getcmdwintype() == \'\' | silent NERDTreeMirror | endif" }) - ''; - } - nerdtree-git-plugin - { - plugin = toggleterm-nvim; - type = "lua"; - config = '' - require("toggleterm").setup{} - - vim.keymap.set('n', 'tf', ':ToggleTerm direction=float', { desc = 'Open a new terminal in float buffer' }) - vim.keymap.set('n', 'tt', ':ToggleTerm direction=tab', { desc = 'Open a new terminal in a new tab' }) - vim.keymap.set('n', 'tv', ':ToggleTerm direction=vertical', { desc = 'Open in a vertical splitted buffer' }) - vim.keymap.set('n', 'th', ':ToggleTerm', { desc = 'Open in a horizontal splitted buffer' }) - ''; - } - { - plugin = neogit; - type = "lua"; - config = '' - require('neogit').setup {} - ''; - } - { - plugin = gitsigns-nvim; - type = "lua"; - config = '' - require('gitsigns').setup() - ''; - } - vim-multiple-cursors - vim-sleuth - vim-commentary - { - plugin = telescope-nvim; - type = "lua"; - config = '' - local telescope = require('telescope.builtin') - - vim.keymap.set('n', 'ff', telescope.find_files, { desc = 'Search file with Telescope' }) - vim.keymap.set('n', 'fg', telescope.live_grep, { desc = 'Live grep with Telescope'}) - vim.keymap.set('n', 'fb', telescope.buffers, { desc = 'Search amongst current buffers (opened files)'}) - vim.keymap.set('n', 'fh', telescope.help_tags, { desc = 'Search within nvim manual'}) - vim.keymap.set('n', 'fs', telescope.lsp_workspace_symbols, { desc = 'Search symbol' }) - ''; - } - plenary-nvim - telescope-fzy-native-nvim - - # Language support plugins - vim-nix - vim-nixhash - { - plugin = rust-vim; - type = "lua"; - config = '' - vim.g.rustfmt_autosave = 1 - ''; - } - vim-markdown - markdown-preview-nvim - - { - plugin = vimtex; - type = "viml"; - config = '' - let g:vimtex_view_method = 'zathura' - let g:vimtex_compiler_method = 'tectonic' - - let g:vimtex_compiler_tectonic = { - \'out_dir' : ' ', - \'hooks' : [], - \'options' : [ - \ '--keep-logs', - \ '--synctex', - \ '-Zshell-escape', - \ '-Zshell-escape-cwd=$PWD' - \], - \} - - ''; - } - - # Autocompletion and LSP server - nvim-lspconfig - nvim-cmp - cmp-path - cmp-cmdline - cmp-buffer - cmp-nvim-lsp - vim-vsnip - ]; - }; - - config.xdg.configFile.nvim = mkIf config.desktop.enableNeovim { - source = ./luaconfig; - recursive = true; - }; -} diff --git a/modules/workstation/home-manager/neovim/luaconfig/keybindings.lua b/modules/workstation/home-manager/neovim/luaconfig/keybindings.lua deleted file mode 100644 index 4e7a878..0000000 --- a/modules/workstation/home-manager/neovim/luaconfig/keybindings.lua +++ /dev/null @@ -1,11 +0,0 @@ --- Navigate around panes -vim.keymap.set('n', '', 'h', { desc = 'Navigate to left pane' }) -vim.keymap.set('n', '', 'l', { desc = 'Navigate to right pane' }) -vim.keymap.set('n', '', 'k', { desc = 'Navigate to upper pane' }) -vim.keymap.set('n', '', 'j', { desc = 'Toogle lower pane' }) - --- Move panes position -vim.keymap.set('n', '', 'H', { desc = 'Navigate to left pane' }) -vim.keymap.set('n', '', 'L', { desc = 'Navigate to right pane' }) -vim.keymap.set('n', '', 'K', { desc = 'Navigate to upper pane' }) -vim.keymap.set('n', '', 'J', { desc = 'Toogle lower pane' }) diff --git a/modules/workstation/home-manager/neovim/luaconfig/lspconfig.lua b/modules/workstation/home-manager/neovim/luaconfig/lspconfig.lua deleted file mode 100644 index 816475d..0000000 --- a/modules/workstation/home-manager/neovim/luaconfig/lspconfig.lua +++ /dev/null @@ -1,94 +0,0 @@ --- Nvim LSP Config - -local map_opts = { noremap=true, silent=true } - -vim.keymap.set('n', 'e', vim.diagnostic.open_float, map_opts) -vim.keymap.set('n', 'p', vim.diagnostic.goto_prev, map_opts) -vim.keymap.set('n', 'n', vim.diagnostic.goto_next, map_opts) -vim.keymap.set('n', 'l', vim.diagnostic.setloclist, map_opts) - - --- Enable keybinds on LSP server attach -local on_attach = function(client, bufnr) - -- Enable completion triggered by - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings - local bufopts = { noremap=true, silent=true, buffer=bufnr } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) - vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) - vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) - vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) - vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) -end - --- Set-up autocompletion - -local cmp = require('cmp') -vim.opt.completeopt = {'menu', 'menuone', 'noselect'} - -cmp.setup({ - snippet = { - -- Necessary snippet engine - expand = function (args) - vim.fn["vsnip#anonymous"](args.body) - end, - }, - - window = { - -- completion = cmp.config.window.bordered(), - -- documentation = cmp.config.window.bordered, - }, - - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({select = true}), - }), - - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'vsnip' }, - }, { { name = 'buffer' } }), -}) - - --- Language servers setup -local capabilities = require('cmp_nvim_lsp').default_capabilities() - -require('lspconfig')['rust_analyzer'].setup { - on_attach = on_attach, - capabilities = capabilities, -} - -require('lspconfig')['rnix'].setup { - on_attach = on_attach, - capabilities = capabilities -} - -require('lspconfig')["nil_ls"].setup { - on_attach = on_attach, - capabilities = capabilities -} - -require('lspconfig')['ltex'].setup { - on_attach = on_attach, - capabilities = capabilities -} - -require('lspconfig')['texlab'].setup { - on_attach = on_attach, - capabilities = capabilities -} diff --git a/modules/workstation/home-manager/neovim/luaconfig/settings.lua b/modules/workstation/home-manager/neovim/luaconfig/settings.lua deleted file mode 100644 index 1b1887a..0000000 --- a/modules/workstation/home-manager/neovim/luaconfig/settings.lua +++ /dev/null @@ -1,17 +0,0 @@ --- Set line numbers -vim.opt.number = true - --- Replace tab with whitespaces -vim.opt.expandtab = true - --- Set tabs as 4 whitespaces -vim.opt.tabstop = 4 - --- Set indentation adaptability -vim.opt.autoindent = true - --- Set default level of identation -vim.opt.shiftwidth = 4 - --- Use the system clipboard -vim.opt.clipboard = 'unnamedplus'