Skip to content

Commit

Permalink
Add Lua configuration example
Browse files Browse the repository at this point in the history
Close #1258
  • Loading branch information
junegunn committed Feb 3, 2024
1 parent ca0ae0a commit e07c186
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down

0 comments on commit e07c186

Please sign in to comment.