From 1b805cdde4fc111a441d213cfc024ee9a820d4b3 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Mon, 16 Jan 2023 06:43:06 -0700 Subject: [PATCH] neovim: install mind, setup some lsp for lua and more telescope bindings --- configs/neovim.lua | 80 ++++++++++++++++++++++++++-------------------- configs/neovim.nix | 21 ++++++++++-- 2 files changed, 64 insertions(+), 37 deletions(-) diff --git a/configs/neovim.lua b/configs/neovim.lua index c389882..3d4a315 100644 --- a/configs/neovim.lua +++ b/configs/neovim.lua @@ -17,18 +17,18 @@ cmd("hi! LineNr NONE"); cmd("hi! Search cterm=NONE ctermbg=yellow"); require("compe").setup { - enabled = true; - autocomplete = true; - source = { - path = true; - buffer = true; - calc = true; - nvim_lsp = true; - nvim_lua = true; - vsnip = true; - ultisnips = true; - luasnip = true; - }; + enabled = true; + autocomplete = true; + source = { + path = true; + buffer = true; + calc = true; + nvim_lsp = true; + nvim_lua = true; + vsnip = true; + ultisnips = true; + luasnip = true; + }; } local telescope = require('telescope') @@ -36,37 +36,47 @@ telescope.load_extension('manix') telescope.load_extension('fzf') require("nvim-tree").setup({ - renderer = { - icons = { - show = false, - webdev_colors = false, - show = { - file = false, - folder = false, - folder_arrow = false, - git = true, - }, - }, - }, + renderer = { + icons = { + --show = false, + webdev_colors = false, + show = { + file = false, + folder = false, + folder_arrow = false, + git = true, + }, + }, + }, }) -cmd[[highlight NvimTreeOpenedFolderName guifg=default]] -cmd[[highlight NvimTreeFolderName guifg=default]] +require 'mind'.setup() + +cmd [[highlight NvimTreeOpenedFolderName guifg=default]] +cmd [[highlight NvimTreeFolderName guifg=default]] local lspc = require("lspconfig") lspc.gopls.setup {}; lspc.nil_ls.setup {}; +lspc.sumneko_lua.setup {}; o.hlsearch = true; -map('n', '', ':NvimTreeToggle', {noremap = true}) -map('n', '', ':Files', {noremap = true}) -map('n', '', ':Telescope manix', {noremap = true}) -map('n', 'r', ':NvimTreeRefresh', {noremap = true}) -map('n', 's', ':%s/\\s\\+$//e', {noremap = true}) +map('n', '', ':NvimTreeToggle', { noremap = true }) +map('n', '', ':Files', { noremap = true }) +map('n', 'r', ':NvimTreeRefresh', { noremap = true }) +map('n', 's', ':%s/\\s\\+$//e', { noremap = true }) +map('n', 'fm', ':Telescope manix', {}) -map('n', '1', ':GitGutterToggle', {noremap = true}) -map('n', '2', ':set list!', {noremap = true}) -map('n', '3', ':set nu!', {noremap = true}) -map('n', '4', ':set paste!', {noremap = true}) +map('n', '1', ':GitGutterToggle', { noremap = true }) +map('n', '2', ':set list!', { noremap = true }) +map('n', '3', ':set nu!', { noremap = true }) +map('n', '4', ':set paste!', { noremap = true }) +vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) + +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', builtin.find_files, {}) +vim.keymap.set('n', 'fg', builtin.live_grep, {}) +vim.keymap.set('n', 'fb', builtin.buffers, {}) +vim.keymap.set('n', 'fh', builtin.help_tags, {}) diff --git a/configs/neovim.nix b/configs/neovim.nix index c0e66a0..241ceeb 100644 --- a/configs/neovim.nix +++ b/configs/neovim.nix @@ -21,6 +21,19 @@ let sha256 = "sha256-eea0Ntr3gCmF6iZ0adZaVswWH70K9IJZ4SAyVSdFp3E="; }; }; + mind = pkgs.vimUtils.buildVimPluginFrom2Nix rec { + pname = "mind.nvim"; + version = "2.2.1"; + src = pkgs.fetchFromGitHub { + owner = "phaazon"; + repo = pname; + rev = "79e0ca131d5e37dfa65f3f0e725d99742e4ff783"; + sha256 = "sha256-y64F9v7Ggzagmz2p2EYTdtKDuGyA19xYXqW92S0tRj0="; + }; + nativeBuildBuildInputs = with vimPlugins; [ + plenary-nvim + ]; + }; baseVimPackages = with vimPlugins; [ fugitive fzf-vim @@ -32,12 +45,14 @@ let telescope-nvim vimagit vim-gitgutter + vim-lua vim-nix vim-ocaml zig-vim parchment vacme + mind ]; myVimPackages = if pkgs.system == "aarch64-linux" then baseVimPackages @@ -45,12 +60,14 @@ let baseVimPackages ++ [ vimPlugins.vim-go vimPlugins.telescope-manix ]; in { environment.systemPackages = with pkgs; [ + fzf go gopls gotools - ripgrep - fzf + luaformatter manix + ripgrep + sumneko-lua-language-server ]; programs.neovim = { enable = true;