File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,18 @@ n³ will detect env variables defined in `vimrc`.
143143let $NNN_TRASH=1
144144```
145145
146+ #### Setup for ` init.lua `
147+
148+ Use the same option names as you would in Vimscript, e.g.:
149+
150+ ``` lua
151+ require (' nnn' ).setup {
152+ set_default_mappings = false ,
153+ session = ' global' ,
154+ layout = { left = ' 20%' }
155+ }
156+ ```
157+
146158### Credits
147159
148160Main n³ program: https://github.com/jarun/nnn
Original file line number Diff line number Diff line change @@ -185,6 +185,18 @@ g:nnn#shell *g:nnn#shell*
185185 Default: &shell
186186 The shell to run the terminal window.
187187
188+ require('nnn' ).setup{} *nnn-lua-setup*
189+ Default: same as Vimscript defaults
190+ An alternative way to configure n³ more suitable for
191+ init.lua users. For example:
192+ >
193+ require('nnn').setup{
194+ set_default_mappings = false,
195+ session = 'global',
196+ layout = { left = '20%' }
197+ }
198+ <
199+
188200
189201-----------------------------------------------------------------------------
190202Functions *nnn-func*
Original file line number Diff line number Diff line change 1+ local M = {}
2+
3+ M .valid_options = {
4+ ' session' ,
5+ ' set_default_mappings' ,
6+ ' layout' ,
7+ ' action' ,
8+ ' session' ,
9+ ' command' ,
10+ }
11+
12+ function M .setup (config )
13+ for k , v in pairs (config ) do
14+ if not vim .tbl_contains (M .valid_options , k ) then
15+ error (" Invalid option to nnn setup(): " .. vim .inspect (k ))
16+ end
17+ vim .g [' nnn#' .. k ] = v
18+ end
19+ end
20+
21+ return M
You can’t perform that action at this time.
0 commit comments