From e07c18608f444cc3ecac72ca8a537453b2d1e042 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 3 Feb 2024 19:51:21 +0900 Subject: [PATCH] Add Lua configuration example Close #1258 --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/README.md b/README.md index 2602467..ce7c239 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,53 @@ call plug#end() Reload .vimrc and `:PlugInstall` to install plugins. +#### Example (Lua configuration file for Neovim) + +In Neovim, you can write your configuration in a Lua script file named +`init.lua`. The following code is the Lua script equivalent to the VimScript +example above. + +```lua +local vim = vim +local Plug = vim.fn['plug#'] + +vim.call('plug#begin') + +-- Shorthand notation; fetches https://github.com/junegunn/vim-easy-align +Plug('junegunn/vim-easy-align') + +-- Any valid git URL is allowed +Plug('https://github.com/junegunn/vim-github-dashboard.git') + +-- Multiple Plug commands can be written in a single line using ; separators +Plug('SirVer/ultisnips'); Plug('honza/vim-snippets') + +-- On-demand loading +Plug('preservim/nerdtree', { ['on'] = 'NERDTreeToggle' }) +Plug('tpope/vim-fireplace', { ['for'] = 'clojure' }) + +-- Using a non-default branch +Plug('rdnetto/YCM-Generator', { ['branch'] = 'stable' }) + +-- Using a tagged release; wildcard allowed (requires git 1.9.2 or above) +Plug('fatih/vim-go', { ['tag'] = '*' }) + +-- Plugin options +Plug('nsf/gocode', { ['tag'] = 'v.20150303', ['rtp'] = 'vim' }) + +-- Plugin outside ~/.vim/plugged with post-update hook +Plug('junegunn/fzf', { ['dir'] = '~/.fzf', ['do'] = './install --all' }) + +-- Unmanaged plugin (manually installed and updated) +Plug('~/my-prototype-plugin') + +vim.call('plug#end') +``` + +More examples can be found in: + +* https://gitlab.com/sultanahamer/dotfiles/-/blob/master/nvim/lua/plugins.lua?ref_type=heads + ### Commands | Command | Description |