From 489bb981a891f86a2e5ffc09bf2a049473843604 Mon Sep 17 00:00:00 2001 From: Jellyfish Date: Sat, 18 Jan 2025 22:26:50 -0800 Subject: [PATCH] setup telescope, treesitter, autopairs plugins for neovim --- .config/nvim/init.lua | 2 +- .config/nvim/lazy-lock.json | 7 +++++ .config/nvim/lua/config/lazy.lua | 35 +++++++++++++++++++++++++ .config/nvim/lua/plugins/autopairs.lua | 4 +++ .config/nvim/lua/plugins/lazy.lua | 0 .config/nvim/lua/plugins/telescope.lua | 14 ++++++++++ .config/nvim/lua/plugins/treesitter.lua | 21 +++++++++++++++ .stow-local-ignore | 2 ++ 8 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 .config/nvim/lazy-lock.json create mode 100644 .config/nvim/lua/config/lazy.lua create mode 100644 .config/nvim/lua/plugins/autopairs.lua delete mode 100644 .config/nvim/lua/plugins/lazy.lua create mode 100644 .config/nvim/lua/plugins/telescope.lua create mode 100644 .config/nvim/lua/plugins/treesitter.lua diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 7623496..6862b5c 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,3 +1,3 @@ require("config.bindings") -require("plugins.lazy") +require("config.lazy") require("config.options") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..cb18a60 --- /dev/null +++ b/.config/nvim/lazy-lock.json @@ -0,0 +1,7 @@ +{ + "auto-pairs": { "branch": "master", "commit": "39f06b873a8449af8ff6a3eee716d3da14d63a76" }, + "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, + "nvim-treesitter": { "branch": "master", "commit": "5da195ac3dfafd08d8b10756d975f0e01e1d563a" }, + "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" } +} diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..46bd007 --- /dev/null +++ b/.config/nvim/lua/config/lazy.lua @@ -0,0 +1,35 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + -- automatically check for plugin updates + checker = { enabled = true }, +}) + diff --git a/.config/nvim/lua/plugins/autopairs.lua b/.config/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..b13f535 --- /dev/null +++ b/.config/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,4 @@ +return { + "jiangmiao/auto-pairs" +} + diff --git a/.config/nvim/lua/plugins/lazy.lua b/.config/nvim/lua/plugins/lazy.lua deleted file mode 100644 index e69de29..0000000 diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..217f726 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,14 @@ + +-- Setups +return { + 'nvim-telescope/telescope.nvim', tag = '0.1.8', + -- or , branch = '0.1.x', + dependencies = { 'nvim-lua/plenary.nvim' } +} + +-- Keybindings +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) +vim.keymap.set('n', 'fb', builtin.buffers) +vim.keymap.set('n', 'fg', builtin.live_grep) +vim.keymap.set('n', 'fh', builtin.help_tags) diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..c572afa --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,21 @@ +local languages = {"c", "lua", "vim", "vimdoc", "javascript", "html", "java", "typescript", "tsx", "python"} +local M = { + "nvim-treesitter/nvim-treesitter", + build = function() + require("nvim-treesitter.install").update({ with_sync = true })() + end, + opts = function () + local configs = require("nvim-treesitter.configs") + + configs.setup({ + ensure_installed = languages, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end +} + + +return { M } + diff --git a/.stow-local-ignore b/.stow-local-ignore index 50cff90..286b261 100644 --- a/.stow-local-ignore +++ b/.stow-local-ignore @@ -2,3 +2,5 @@ README.md .git scripts Makefile +.config/pulse +