Add Lua configuration example

Close #1258
This commit is contained in:
Junegunn Choi 2024-02-03 19:51:21 +09:00
parent ca0ae0a8b1
commit e07c18608f
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
1 changed files with 47 additions and 0 deletions

View File

@ -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 |