changeset 324:64a0c6cec54c

Use packer for plugin management in lua
author zegervdv <zegervdv@me.com>
date Tue, 22 Dec 2020 15:42:45 +0100
parents 3b25f3aa7014
children ce396166d009
files dot_config/nvim/config.lua dot_config/nvim/init.vim
diffstat 2 files changed, 105 insertions(+), 169 deletions(-) [+]
line wrap: on
line diff
--- a/dot_config/nvim/config.lua	Mon Dec 21 17:16:16 2020 +0100
+++ b/dot_config/nvim/config.lua	Tue Dec 22 15:42:45 2020 +0100
@@ -1,3 +1,108 @@
+--
+-- Neovim dotfiles
+--
+--
+
+local execute = vim.api.nvim_command
+local fn = vim.fn
+
+-- Bootstrap package manager
+local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
+
+if fn.empty(fn.glob(install_path)) > 0 then
+  execute('!git clone https://github.com/wbthomason/packer.nvim '..install_path)
+end
+
+require('packer').startup(function()
+  use {'wbthomason/packer.nvim'}
+
+  -- General plugins
+  use {'tpope/vim-sensible'}
+  use {'tpope/vim-repeat'}
+  use {'tpope/vim-rsi'}
+  use {'sgur/vim-editorconfig'}
+  use {'ShikChen/osc52.vim'}
+  use {'einfachtoll/didyoumean'}
+
+  use {'tpope/vim-obsession'}
+  use {
+    'tpope/vim-eunuch',
+    cmd = {
+      'Remove',
+      'Unlink',
+      'Move',
+      'Rename',
+      'Mkdir',
+      'Chmod',
+      'Find',
+      'Locate',
+      'SudoEdit',
+      'SudoWrite'
+    }
+  }
+
+  -- Spelling/autocorrection
+  use {'tpope/vim-abolish'}
+
+  -- Git/VCS
+  use {'vim-scripts/gitignore'}
+  use {'sjl/splice.vim', opt = true, cmd = {'SpliceInit'}}
+  use {'tpope/vim-git'}
+
+  -- Comments
+  use {'tpope/vim-commentary'}
+
+  -- Undoing
+  use {'sjl/gundo.vim', cmd = {'GundoToggle'}}
+
+  -- Parentheses etc
+  use {'tpope/vim-surround'}
+  use {'raimondi/delimitMate'}
+  use {'zegervdv/vim-endwise'}
+
+  -- Moving around within lines
+  use {'wellle/targets.vim', event = 'InsertEnter *'}
+
+  -- Searching
+  use {'mhinz/vim-grepper', cmd = {'Grepper'}}
+
+  -- Indent lines
+  use {'Yggdroot/indentline'}
+  use {'lukas-reineke/indent-blankline.nvim', branch = 'lua'}
+
+  -- Tmux
+  use {'christoomey/vim-tmux-navigator', cond = os.getenv('TMUX')}
+  use {'tmux-plugins/vim-tmux-focus-events', cond = os.getenv('TMUX')}
+
+  -- Completion/snippets/LSP
+  use {'neovim/nvim-lspconfig'}
+  use {
+    'nvim-lua/completion-nvim',
+    'steelsojka/completion-buffers'
+  }
+  use {
+    'nvim-treesitter/nvim-treesitter',
+    'nvim-treesitter/nvim-treesitter-refactor',
+    'nvim-treesitter/nvim-treesitter-textobjects',
+    {'nvim-treesitter/playground', opt = true}
+  }
+  use {
+    'nvim-telescope/telescope.nvim',
+    requires = {
+      'nvim-lua/popup.nvim',
+      'nvim-lua/plenary.nvim'
+    }
+  }
+
+  -- File navigation
+  use {'justinmk/vim-dirvish'}
+
+  -- Colorscheme
+  use {'zegervdv/nvcode-color-schemes.vim'}
+
+end)
+
+
 local lsp = require'lspconfig'
 local lsputil = require'lspconfig.util'
 
--- a/dot_config/nvim/init.vim	Mon Dec 21 17:16:16 2020 +0100
+++ b/dot_config/nvim/init.vim	Tue Dec 22 15:42:45 2020 +0100
@@ -3,175 +3,6 @@
 let s:darwin = has('mac')
 let s:windows = has('win32')
 
-" Include Vim-Plug {{{
-if !s:windows
-  if has('nvim')
-    if empty(glob('~/.config/nvim/autoload/plug.vim'))
-      silent !mkdir -p ~/.config/nvim/autoload
-      silent !curl -fLo ~/.config/nvim/autoload/plug.vim
-            \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
-      autocmd VimEnter * PlugInstall
-    endif
-  else
-    if empty(glob('~/.vim/autoload/plug.vim'))
-      silent !mkdir -p ~/.vim/autoload
-      silent !curl -fLo ~/.vim/autoload/plug.vim
-            \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
-      autocmd VimEnter * PlugInstall
-    endif
-  endif
-endif
-
-" }}}
-" Vim-Plug {{{
-let g:plug_window='topleft new'
-
-if has('nvim')
-  call plug#begin('~/.config/nvim/plugged')
-else
-  call plug#begin('~/.vim/plugged')
-endif
-
-" General Plugins
-Plug 'tpope/vim-sensible'
-
-if s:darwin
-  Plug 'vim-scripts/gitignore'
-endif
-
-Plug 'sjl/splice.vim'
-
-Plug 'tpope/vim-repeat'
-Plug 'tpope/vim-rsi'
-Plug 'einfachtoll/didyoumean'
-
-" Session Management
-Plug 'tpope/vim-obsession'
-
-" Spelling
-Plug 'tpope/vim-abolish'
-
-" Settings
-Plug 'sgur/vim-editorconfig'
-
-" Brackets
-Plug 'tpope/vim-surround'
-Plug 'raimondi/delimitMate'
-Plug 'zegervdv/vim-endwise'
-
-" Formatting
-Plug 'junegunn/vim-easy-align', { 'on' : [] }
-augroup load_easy_align
-  autocmd!
-  autocmd CursorHold,CursorHoldI * call plug#load('vim-easy-align') | autocmd! load_easy_align
-augroup END
-
-" Comments
-Plug 'tpope/vim-commentary'
-
-" Moving in files
-Plug 'wellle/targets.vim', { 'on': [] }
-augroup load_targets
-  autocmd!
-  autocmd InsertEnter * call plug#load('targets.vim') | autocmd! load_targets
-augroup END
-Plug 'mhinz/vim-grepper', { 'on' : 'Grepper' }
-
-" Indentation
-" Plug 'nathanaelkane/vim-indent-guides'
-Plug 'Yggdroot/indentline'
-Plug 'lukas-reineke/indent-blankline.nvim', { 'branch': 'lua' }
-
-" Command line
-Plug 'tpope/vim-eunuch', { 'on' : ['Remove', 'Unlink', 'Move', 'Rename', 'Mkdir', 'Chmod', 'Find', 'Locate', 'SudoEdit', 'SudoWrite']}
-
-" Undoing
-Plug 'sjl/gundo.vim', { 'on': 'GundoToggle' }
-
-" Tabs
-Plug 'gcmt/taboo.vim'
-
-" Other
-Plug 'yuttie/comfortable-motion.vim'
-Plug 'tpope/vim-apathy'
-
-" Tmux
-Plug 'christoomey/vim-tmux-navigator'
-Plug 'tmux-plugins/vim-tmux-focus-events'
-
-" Background make
-Plug 'tpope/vim-dispatch'
-
-" Completing and snippets
-Plug 'sirver/ultisnips'
-Plug 'honza/vim-snippets'
-if has('nvim')
-   Plug 'neovim/nvim-lsp'
-   Plug 'nvim-lua/completion-nvim'
-   Plug 'nvim-treesitter/nvim-treesitter'
-   Plug 'nvim-treesitter/nvim-treesitter-refactor'
-   Plug 'nvim-treesitter/nvim-treesitter-textobjects'
-   Plug 'nvim-treesitter/playground'
-   Plug 'steelsojka/completion-buffers'
-   Plug 'nvim-treesitter/completion-treesitter'
-   Plug 'nvim-lua/popup.nvim'
-   Plug 'nvim-lua/plenary.nvim'
-   Plug 'nvim-telescope/telescope.nvim'
-endif
-
-" Copying
-Plug 'ShikChen/osc52.vim'
-
-" Vim file navigation
-Plug 'justinmk/vim-dirvish'
-Plug 'tpope/vim-projectionist'
-
-" Theme
-Plug 'NLKNguyen/papercolor-theme'
-Plug 'zegervdv/nvcode-color-schemes.vim'
-
-"Tcl
-Plug 'vim-scripts/tcl.vim--smithfield-indent', { 'for': 'tcl'}
-
-Plug 'sbdchd/neoformat'
-
-Plug 'Glench/Vim-Jinja2-Syntax'
-
-if s:darwin
-  " Ruby
-  Plug 'tpope/vim-rails', { 'for': 'ruby' }
-  Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' }
-  Plug 'tpope/vim-bundler', { 'for': 'ruby' }
-  Plug 'tpope/vim-rake', { 'for': 'ruby' }
-  Plug 'slim-template/vim-slim', { 'for': 'ruby' }
-  Plug 'duwanis/tomdoc.vim', { 'for': 'ruby' }
-  Plug 'keith/rspec.vim', { 'for': 'rspec' }
-
-  " Markdown
-  Plug 'tpope/vim-markdown', { 'for': 'markdown' }
-
-  " Jade
-  Plug 'digitaltoad/vim-jade', { 'for': 'jade' }
-
-  " Latex
-  Plug 'lervag/vimtex', { 'for': 'tex' }
-endif
-
-" Coffeescript
-Plug 'kchmck/vim-coffee-script', { 'for': 'coffee' }
-
-" C
-Plug 'NLKNguyen/c-syntax.vim', { 'for': 'c'  }
-
-" Python
-Plug 'Vimjas/vim-python-pep8-indent', { 'for': 'python' }
-Plug 'vim-python/python-syntax', { 'for': 'python' }
-
-" Git
-Plug 'tpope/vim-git'
-call plug#end()
-" }}}
-
 " Activate built in plugins {{{
 if !has('nvim')
   if has('packages')