mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
vim plugin has a new project page
This commit is contained in:
parent
78614f9fbf
commit
0abe07f9bd
10
README.md
10
README.md
|
@ -23,7 +23,7 @@ Noice is Not Noice, a noicer fork...
|
|||
|
||||
`nnn` is probably the [fastest and most resource-sensitive](#performance) file manager you have ever used. It integrates seamlessly with your DE and favourite GUI utilities, has a unique [navigate-as-you-type](#navigate-as-you-type-mode) mode with auto-select, disk usage analyzer mode, bookmarks, contexts, application launcher, familiar navigation shortcuts, subshell spawning and much more.
|
||||
|
||||
[Integrate utilities](https://github.com/jarun/nnn#sample-scripts) like sxiv or fzy easily, or use it as a [vim file picker](https://github.com/jarun/nnn#vim-plugin); `nnn` supports as many scripts as you need!
|
||||
[Integrate utilities](https://github.com/jarun/nnn#sample-scripts) like sxiv or fzy easily, or use it as a [vim file picker](https://github.com/jarun/nnn#neovim-plugin); `nnn` supports as many scripts as you need!
|
||||
|
||||
It runs on Linux, OS X, Raspberry Pi, Cygwin, Linux subsystem for Windows and Termux.
|
||||
|
||||
|
@ -63,7 +63,7 @@ It runs on Linux, OS X, Raspberry Pi, Cygwin, Linux subsystem for Windows and Te
|
|||
- [quote paths](#quote-paths)
|
||||
- [to clipboard](#to-clipboard)
|
||||
- [cd on quit](#cd-on-quit)
|
||||
- [vim plugin](#vim-plugin)
|
||||
- [(neo)vim plugin](#neovim-plugin)
|
||||
- [run custom scripts](#run-custom-scripts)
|
||||
- [sample scripts](#sample-scripts)
|
||||
- [change dir color](#change-dir-color)
|
||||
|
@ -81,7 +81,7 @@ It runs on Linux, OS X, Raspberry Pi, Cygwin, Linux subsystem for Windows and Te
|
|||
|
||||
- Modes
|
||||
- Basic, detail (default), disk usage analyzer (du)
|
||||
- Vim file picker (as a vim plugin)
|
||||
- Vim (or neovim) file picker (as a plugin)
|
||||
- Navigation
|
||||
- Familiar, easy shortcuts (arrows, `~`, `-`, `&`)
|
||||
- *Navigate-as-you-type* with auto-select directory
|
||||
|
@ -441,9 +441,9 @@ Pick the appropriate file for your shell from [`scripts/quitcd`](scripts/quitcd)
|
|||
|
||||
As you might notice, `nnn` uses the environment variable `NNN_TMPFILE` to write the last visited directory path. You can change it.
|
||||
|
||||
#### vim plugin
|
||||
#### (neo)vim plugin
|
||||
|
||||
`nnn` can be used as a file picker/chooser within vim. The instructions are available in the [nnn-picker.vim](https://github.com/jarun/nnn/blob/master/scripts/vim-plugin/nnn-picker.vim) plugin.
|
||||
`nnn` can be used as a file picker/chooser within vim or neovim. Find the plugin [here](https://github.com/mcchrish/nnn.vim).
|
||||
|
||||
#### run custom scripts
|
||||
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
" vim/neovim plugin to use nnn as a file picker
|
||||
" Closely follows and inspired by the vim_file_chooser plugin for ranger.
|
||||
"
|
||||
" Author: Arun Prakash Jana
|
||||
" Email: engineerarun@gmail.com
|
||||
" Homepage: https://github.com/jarun/nnn
|
||||
" Copyright © 2018 Arun Prakash Jana
|
||||
"
|
||||
" Usage:
|
||||
" Copy this file to the vim/neovim plugin directory.
|
||||
" To open nnn as a file picker in vim/neovim, use the command ":NnnPicker" or
|
||||
" ":Np" or the key-binding "<leader>n". Once you select one or more files and
|
||||
" quit nnn, vim/neovim will open the first selected file and add the remaining
|
||||
" files to the arg list/buffer list. If no file is explicitly selected, the
|
||||
" last selected entry is picked.
|
||||
|
||||
let s:temp = ""
|
||||
|
||||
fun! s:T_OnExit(job_id, code, event) dict
|
||||
if a:code == 0
|
||||
bd!
|
||||
call s:evaluate_temp()
|
||||
endif
|
||||
endfun
|
||||
|
||||
fun! s:evaluate_temp()
|
||||
if !filereadable(s:temp)
|
||||
echoerr 'Temp file ' . s:temp . 'not readable!'
|
||||
redraw!
|
||||
" Nothing to read.
|
||||
return
|
||||
endif
|
||||
let names = readfile(s:temp)
|
||||
if empty(names)
|
||||
redraw!
|
||||
" Nothing to open.
|
||||
return
|
||||
endif
|
||||
" Edit the first item.
|
||||
exec 'edit ' . fnameescape(names[0])
|
||||
" Add any remaining items to the arg list/buffer list.
|
||||
for name in names[1:]
|
||||
exec 'argadd ' . fnameescape(name)
|
||||
endfor
|
||||
redraw!
|
||||
endfun
|
||||
|
||||
function! NnnPicker()
|
||||
let s:temp = tempname()
|
||||
let l:cmd = 'nnn -p ' . shellescape(s:temp)
|
||||
|
||||
if has("nvim")
|
||||
enew
|
||||
call termopen(l:cmd, {'on_exit': function('s:T_OnExit')}) | startinsert
|
||||
elseif has("gui_running")
|
||||
exec 'silent !xterm -e ' . l:cmd
|
||||
call s:evaluate_temp()
|
||||
else
|
||||
exec 'silent !' . l:cmd
|
||||
call s:evaluate_temp()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
command! -bar NnnPicker call NnnPicker()
|
||||
nnoremap <leader>n :<C-U>NnnPicker<CR>
|
||||
command! -nargs=* -complete=file Np :call NnnPicker()
|
Loading…
Reference in a new issue