From 9595610e7aec331e21cfc1d433c18c2f9bdfa290 Mon Sep 17 00:00:00 2001 From: surdeus Date: Sat, 26 Aug 2023 10:50:49 +0300 Subject: [PATCH] Tree plugin for Neovim. --- nvim/init.lua | 40 ++++++++++++++++++++++++++++++++++++++++ nvim/lazy-lock.json | 5 +++++ nvim/lua/plugin/tree.lua | 11 +++++++++++ 3 files changed, 56 insertions(+) create mode 100644 nvim/lazy-lock.json create mode 100644 nvim/lua/plugin/tree.lua diff --git a/nvim/init.lua b/nvim/init.lua index 6a991d6..fc6dd5f 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -8,9 +8,49 @@ vim.api.nvim_cmd({ args = {'slate'}, }, {}) +-- Plugin manager "Lazy" +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- Plugins +plugins = { + require("plugin.tree") +} +require("lazy").setup(plugins, opts) + +-- File tree plugin configuration +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +vim.opt.termguicolors = true +require("nvim-tree").setup() +require("nvim-tree").setup({ + sort_by = "case_sensitive", + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = false, + }, +}) + -- Key mapping local map = vim.api.nvim_set_keymap local opts = {noremap = true, silent = true} map('n', 'confr', ':source $HOME/lib/nvim/init.lua\n', opts) map('n', 'confe', ':e $HOME/lib/nvim/init.lua\n', opts) +map('n', '\\ft', ':NvimTreeToggle\n', opts) +map('n', '\\fT', ':NvimTreeOpen .\n', opts) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..d98558d --- /dev/null +++ b/nvim/lazy-lock.json @@ -0,0 +1,5 @@ +{ + "lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" }, + "nvim-tree.lua": { "branch": "master", "commit": "00741206c2df9c4b538055def19b99790f0c95c8" }, + "nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" } +} \ No newline at end of file diff --git a/nvim/lua/plugin/tree.lua b/nvim/lua/plugin/tree.lua new file mode 100644 index 0000000..adffb8a --- /dev/null +++ b/nvim/lua/plugin/tree.lua @@ -0,0 +1,11 @@ +return { + "nvim-tree/nvim-tree.lua", + version = "*", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + require("nvim-tree").setup {} + end, +}