nvim

Personal nvim configurations
git clone https://git.kamikakushi.net/nvim.git
Log | Files | Refs | LICENSE

plugins.lua (2631B)


      1 -- vim: expandtab:ts=2:sw=2
      2 
      3 -- https://github.com/wbthomason/packer.nvim#bootstrapping
      4 local function bootstrap_packer()
      5   local fn = vim.fn
      6   local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
      7   if fn.empty(fn.glob(install_path)) > 0 then
      8     fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
      9     vim.cmd [[packadd packer.nvim]]
     10     return true
     11   end
     12   return false
     13 end
     14 
     15 -- https://github.com/wbthomason/dotfiles/blob/main/dot_config/nvim/lua/plugins.lua
     16 local packer = nil
     17 local function init()
     18   local is_boostrapped = bootstrap_packer()
     19 
     20   if packer == nil then
     21     packer = require('packer')
     22     packer.init({disable_commands = true})
     23   end
     24 
     25   local use = packer.use
     26   packer.reset()
     27 
     28   use 'wbthomason/packer.nvim'
     29   use 'tpope/vim-commentary'
     30   use 'sirtaj/vim-maildrop'
     31   use {
     32     'sindrets/diffview.nvim',
     33     requires = 'nvim-lua/plenary.nvim',
     34     config = function()
     35       require("diffview").setup({
     36         use_icons = false,
     37         signs = {
     38           fold_closed = '-',
     39           fold_open = '+',
     40         },
     41       })
     42       vim.api.nvim_create_user_command("DO", "DiffviewOpen", {})
     43     end
     44   }
     45   use {
     46     'nvim-tree/nvim-tree.lua',
     47     config = function()
     48       vim.o.termguicolors = true
     49       require('nvim-tree').setup({
     50         filesystem_watchers = {
     51           enable = false,
     52         },
     53         hijack_directories = {
     54           enable = true,
     55           auto_open = true,
     56         },
     57         open_on_setup = true,
     58         renderer = {
     59           indent_markers = { enable = true },
     60           icons = {
     61             glyphs = {
     62               bookmark = '!',
     63             },
     64             show = {
     65               file = false,
     66               folder = false,
     67               folder_arrow = false,
     68               git = false,
     69             }
     70           },
     71         },
     72         sync_root_with_cwd = true,
     73         view = {
     74           mappings = {
     75             list = {
     76               {
     77                 key = 'gp',
     78                 action = 'set_parent',
     79                 action_cb = function(node)
     80                   if node.type == 'directory' then
     81                     vim.fn.chdir(node.absolute_path)
     82                   end
     83                 end,
     84               },
     85             },
     86           },
     87         },
     88       })
     89       vim.keymap.set('n', '<C-w><C-b>', ':NvimTreeToggle<CR>')
     90       vim.keymap.set('n', '<C-w><C-g>', require("nvim-tree.api").marks.navigate.select)
     91     end
     92   }
     93 
     94   if is_boostrapped then
     95     packer.sync()
     96   end
     97 end
     98 
     99 local plugins = setmetatable({}, {
    100   __index = function(_, key)
    101     init()
    102     return packer[key]
    103   end,
    104 })
    105 
    106 return plugins
    107