Skip to content

Commit ed06cc9

Browse files
committed
improve doc
1 parent 190cc3c commit ed06cc9

File tree

2 files changed

+33
-25
lines changed

2 files changed

+33
-25
lines changed

README.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ https://user-images.githubusercontent.com/7200153/127453278-3e638e33-707a-49c8-b
88
<small>colorscheme <a href="https://github.com/pgdouyon/vim-yin-yang">yin</a></small>
99
</p>
1010

11-
### Requirements
11+
## Requirements
1212

1313
1.
1414
2. `has('nvim') || has('terminal')` i.e. terminal support
1515
3. Optional `has('nvim-0.5') || has('popupwin')` for floating window
1616

17-
### Install
17+
## Install
1818

1919
n³ must be installed. Instructions
2020
[here](https://github.com/jarun/nnn/wiki/Usage#installation).
@@ -26,7 +26,7 @@ Then install the plugin using your plugin manager:
2626
Plug 'mcchrish/nnn.vim'
2727
```
2828

29-
### Usage
29+
## Usage
3030

3131
To open n³ as a file picker in vim/neovim, use the command `:NnnPicker` or the
3232
key-binding `<leader>n`. The command accepts an optional path to open e.g.
@@ -48,9 +48,9 @@ To discard selection and exit, press <kbd>^G</kbd>.
4848

4949
For complete plugin documentation see `:help nnn`.
5050

51-
### Configuration
51+
## Configuration
5252

53-
#### Custom mappings
53+
### Custom mappings
5454

5555
```vim
5656
" Disable default mappings
@@ -63,7 +63,7 @@ nnoremap <silent> <leader>nn :NnnPicker<CR>
6363
nnoremap <leader>n :NnnPicker %:p:h<CR>
6464
```
6565

66-
#### Layout
66+
### Layout
6767

6868
```vim
6969
" Opens the n³ window in a split
@@ -76,7 +76,7 @@ let g:nnn#layout = { 'left': '~20%' } " or right, up, down
7676
let g:nnn#layout = { 'window': { 'width': 0.9, 'height': 0.6, 'highlight': 'Debug' } }
7777
```
7878

79-
#### Action
79+
### Action
8080

8181
It's possible to set extra key-bindings for opening files in various ways.
8282
No default is set so that n³'s key-bindings are not overridden.
@@ -93,7 +93,7 @@ open the selected file in a tab instead of the current window. <kbd>^X</kbd>
9393
will open in a split an so on. Multi-selected files will be loaded in the
9494
buffer list.
9595

96-
#### Persistent session
96+
### Persistent session
9797

9898
n³ sessions can be used to remember the location when it is reopened.
9999

@@ -106,9 +106,9 @@ let g:nnn#session = 'global'
106106
```
107107

108108
Note: If desired, an n³ session can be disabled temporarily by passing
109-
`session: false` as an option to `nnn#pick()`.
109+
`session: 0` as an option to `nnn#pick()`.
110110

111-
#### Command override
111+
### Command override
112112

113113
It's possible to override the default n³ command and add some extra program
114114
options.
@@ -121,7 +121,7 @@ let g:nnn#command = 'nnn -d'
121121
let g:nnn#command = 'NNN_TRASH=1 nnn -d'
122122
```
123123

124-
#### `nnn#pick()`
124+
### `nnn#pick()`
125125

126126
The `nnn#pick([<dir>][,<opts>])` function can be called with a custom directory
127127
and additional options such as opening file in splits or tabs. It's a more
@@ -137,26 +137,32 @@ call nnn#pick('~/some-directory', { 'edit': 'vertical split' })
137137
- `edit` - type of window the select file will be open.
138138
- `layout` - same as `g:nnn#layout` and overrides it if specified.
139139

140-
#### Environment variables
140+
### Environment variables
141141

142142
n³ will detect env variables defined in `vimrc`.
143143

144144
```vim
145145
let $NNN_TRASH=1
146146
```
147147

148-
#### Setup for `init.lua`
148+
### Setup for `init.lua`
149149

150-
Use the same option names as you would in Vimscript, e.g.:
150+
Use the same option names as you would in Vim script, e.g.:
151151

152152
```lua
153-
require('nnn').setup {
154-
set_default_mappings = false,
155-
session = 'global',
156-
layout = { left = '20%' }
157-
}
153+
require("nnn").setup({
154+
command = "nnn -o -C",
155+
set_default_mappings = 0,
156+
replace_netrw = 1,
157+
action = {
158+
["<c-t>"] = "tab split",
159+
["<c-s>"] = "split",
160+
["<c-v>"] = "vsplit",
161+
["<c-o>"] = copy_to_clipboard,
162+
},
163+
})
158164
```
159165

160-
### Credits
166+
## Credits
161167

162-
Main n³ program: https://github.com/jarun/nnn
168+
Main [repository](https://github.com/jarun/nnn).

doc/nnn.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,13 @@ nnn#pick([{dir}][,{opts}]) *nnn#pick()*
208208

209209
{dir} : (string) a directory.
210210
{opts}: (dict) can be:
211-
edit : type of window the select file will be open. Or
212-
pass a FuncRef and array of selected files will
213-
be passed to that function.
214-
layout: same as |g:nnn#layout| and overrides it if
211+
edit : type of window the select file will be open. Or
212+
pass a FuncRef and array of selected files will
213+
be passed to that function.
214+
layout : same as |g:nnn#layout| and overrides it if
215215
specified.
216+
session: set to 0 to disable session regardless of
217+
|g:nnn#session| value.
216218

217219
Example:
218220
>

0 commit comments

Comments
 (0)