diff --git a/home/neovim/default.nix b/home/neovim/default.nix index ba16a16..a3881c9 100644 --- a/home/neovim/default.nix +++ b/home/neovim/default.nix @@ -8,11 +8,11 @@ vimdiffAlias = true; withPython3 = true; extraPackages = with pkgs; [ - ansible-language-server beancount-language-server black docker-compose-language-service efm-langserver + fd gcc hlint ltex-ls @@ -22,6 +22,7 @@ nixpkgs-fmt nodePackages.dockerfile-language-server-nodejs nodePackages.pyright + ripgrep ruff-lsp shellcheck shfmt @@ -34,4 +35,5 @@ plugins = [ pkgs.vimPlugins.packer-nvim ]; extraLuaConfig = builtins.readFile ./init.lua; }; + home.packages = [ pkgs.neovide ]; } diff --git a/home/neovim/init.lua b/home/neovim/init.lua index f8f2079..03183f2 100644 --- a/home/neovim/init.lua +++ b/home/neovim/init.lua @@ -1,11 +1,8 @@ -- luacheck: globals vim require("packer").startup(function(use) - use("tpope/vim-sensible") - - use("vimwiki/vimwiki") + use('nvim-tree/nvim-web-devicons') use("freitass/todo.txt-vim") - use("ledger/vim-ledger") use("psliwka/vim-smoothie") @@ -17,12 +14,11 @@ require("packer").startup(function(use) -- fern use("lambdalisue/fern.vim") - use("lambdalisue/nerdfont.vim") - use("lambdalisue/fern-renderer-nerdfont.vim") use("lambdalisue/glyph-palette.vim") use("lambdalisue/fern-git-status.vim") use("lambdalisue/fern-mapping-git.vim") -- to check use("lambdalisue/fern-hijack.vim") + use("TheLeoP/fern-renderer-web-devicons.nvim") -- airline use("vim-airline/vim-airline") @@ -49,7 +45,6 @@ require("packer").startup(function(use) use("gruvbox-community/gruvbox") -- language support - use("darrikonn/vim-gofmt") use("Glench/Vim-Jinja2-Syntax") use("preservim/vim-markdown") use("LnL7/vim-nix") @@ -57,7 +52,6 @@ require("packer").startup(function(use) use("LaTeX-Box-Team/LaTeX-Box") use("vito-c/jq.vim") use("tpope/vim-haml") - use({ "psf/black", branch = "stable" }) use("elzr/vim-json") use("jpalardy/vim-slime") @@ -71,12 +65,26 @@ require("packer").startup(function(use) use("L3MON4D3/LuaSnip") -- Snippets plugin use("lukas-reineke/lsp-format.nvim") + use { + 'nvim-telescope/telescope.nvim', + requires = { { 'nvim-lua/plenary.nvim' } } + } + use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + use("sheerun/vim-polyglot") use("nvim-treesitter/nvim-treesitter") use("nvim-orgmode/orgmode") + use("akinsho/org-bullets.nvim") + use("lukas-reineke/headlines.nvim") + use("michaelb/sniprun") + use("dhruvasagar/vim-table-mode") end) +vim.g.mapleader = "," +vim.g.maplocaleader = "\\" + + local o = vim.opt local function map(mode, shortcut, command) @@ -121,9 +129,6 @@ else o.listchars = [[tab:> ,extends:>,precedes:<,nbsp:.,trail:_]] end -vim.g.mapleader = "," -vim.g.maplocaleader = "\\" - o.splitbelow = true o.splitright = true nmap("", "r") @@ -176,7 +181,7 @@ vim.g.markdown_syntax_conceal = 0 o.updatetime = 100 -- to make gigutter more responsive -vim.g["fern#renderer"] = "nerdfont" +vim.g["fern#renderer"] = "nvim-web-devicons" vim.cmd([[ function! s:init_fern() abort nmap T (fern-action-open:tab) @@ -196,11 +201,8 @@ augroup my-glyph-palette autocmd FileType nerdtree,startify call glyph_palette#apply() augroup END ]]) -nmap("t", ":Fern . -drawer -toggle") --- nmap("f", ":Files") -nmap("rg", ":Rg") +nmap("tf", ":Fern . -drawer -toggle") nmap("", ": cd ..") -nmap("b", ": Buffers") vim.g["indentLine_char"] = "▏" vim.g["indentLine_setConceal"] = 0 @@ -234,7 +236,6 @@ lspconfig.ruff_lsp.setup { capabilities = capabilities } lspconfig.nixd.setup { capabilities = capabilities } lspconfig.jsonls.setup { capabilities = capabilities } -lspconfig.ansiblels.setup { capabilities = capabilities } lspconfig.beancount.setup { capabilities = capabilities } lspconfig.ltex.setup { capabilities = capabilities } @@ -362,8 +363,15 @@ require("nvim-treesitter.configs").setup { } orgmode.setup { - org_agenda_files = { "~/Nextcloud/org/*" }, - org_default_notes_file = "~/Nextcloud/org/refile.org", + org_agenda_files = { "~/Nextcloud/org/agenda/*.org" }, + org_default_notes_file = "~/Nextcloud/org/notes.org", + org_capture_templates = { + w = { + description = "Wishlist", + template = "* %x", + target = "~/Nextcloud/org/wishlist.org" + } + } } vim.api.nvim_create_autocmd("LspAttach", { @@ -372,9 +380,51 @@ vim.api.nvim_create_autocmd("LspAttach", { -- Enable completion triggered by vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions local opts = { buffer = ev.buf } - vim.keymap.set("n", "", function() - vim.lsp.buf.format({ async = true }) + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'f', function() + vim.lsp.buf.format { async = true } end, opts) end, }) + +local telescope_builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', telescope_builtin.find_files, {}) +vim.keymap.set('n', 'fg', telescope_builtin.live_grep, {}) +vim.keymap.set('n', 'fb', telescope_builtin.buffers, {}) +vim.keymap.set('n', 'fh', telescope_builtin.help_tags, {}) + +local telescope = require("telescope") +telescope.setup { + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + } + } +} +telescope.load_extension("fzf") + +require'nvim-web-devicons'.setup() + +if vim.g.neovide then + vim.o.guifont = "Hack Nerd Font:h10" +end