diff options
author | Marvin Borner | 2019-03-05 01:09:01 +0100 |
---|---|---|
committer | Marvin Borner | 2019-03-05 01:09:01 +0100 |
commit | 55457187d18221e76bd12f0fb2cfab65c49b92fb (patch) | |
tree | 8db042d2d80710d54100c2709ad4332153ac848a /.local/share/nvim |
Initial commit
Diffstat (limited to '.local/share/nvim')
-rw-r--r-- | .local/share/nvim/plugged/nnn.vim/.github/ISSUE_TEMPLATE/bug_report.md | 43 | ||||
-rw-r--r-- | .local/share/nvim/plugged/nnn.vim/.github/ISSUE_TEMPLATE/feature_request.md | 25 | ||||
-rw-r--r-- | .local/share/nvim/plugged/nnn.vim/LICENSE | 26 | ||||
-rw-r--r-- | .local/share/nvim/plugged/nnn.vim/README.md | 126 | ||||
-rw-r--r-- | .local/share/nvim/plugged/nnn.vim/autoload/nnn.vim | 177 | ||||
-rw-r--r-- | .local/share/nvim/plugged/nnn.vim/doc/nnn.txt | 201 | ||||
-rw-r--r-- | .local/share/nvim/plugged/nnn.vim/doc/tags | 21 | ||||
-rw-r--r-- | .local/share/nvim/plugged/nnn.vim/ftplugin/nnn.vim | 17 | ||||
-rw-r--r-- | .local/share/nvim/plugged/nnn.vim/plugin/nnn.vim | 51 |
9 files changed, 687 insertions, 0 deletions
diff --git a/.local/share/nvim/plugged/nnn.vim/.github/ISSUE_TEMPLATE/bug_report.md b/.local/share/nvim/plugged/nnn.vim/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..5ed9c19 --- /dev/null +++ b/.local/share/nvim/plugged/nnn.vim/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,43 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' +--- + +**Describe the bug** + +A clear and concise description of what the bug is. + +**To Reproduce** + +Steps to reproduce the behavior and with the **most minimal configuration**. +With only nnn.vim installed and additional configurations/plugins that helps reproduce the bug: + +1. Open vim +2. Run command '....' +3. Press key '....' +4. See error + +**Expected behavior** + +A clear and concise description of what you expected to happen. + +**Screenshots** + +If applicable, add screenshots/gifs/videos to help explain your problem. + +**Environment:** + +- OS: [e.g. macOS 10.14.2] +- Terminal: [e.g. iterm2 3.2.7beta2] +- Shell: [e.g. zsh 5.2.1, bash 4.1] +- Vim version: [e.g. neovim 0.3.2, vim 8.1 1-239] +- Plugin manager: [e.g. vim-plug, pathogen] +- Plugin version: [e.g. master, commit sha, tag] +- Nnn version: [e.g. 2.1] + +**Additional context** + +Add any other context about the problem here. diff --git a/.local/share/nvim/plugged/nnn.vim/.github/ISSUE_TEMPLATE/feature_request.md b/.local/share/nvim/plugged/nnn.vim/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..f79a7ea --- /dev/null +++ b/.local/share/nvim/plugged/nnn.vim/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,25 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' +--- + +**Is your feature request related to a problem? Please describe.** + +A clear and concise description of what the problem is. Ex. I'm always +frustrated when [...] + +**Describe the solution you'd like** + +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** + +A clear and concise description of any alternative solutions or features you've +considered. + +**Additional context** + +Add any other context or screenshots about the feature request here. diff --git a/.local/share/nvim/plugged/nnn.vim/LICENSE b/.local/share/nvim/plugged/nnn.vim/LICENSE new file mode 100644 index 0000000..a4e514b --- /dev/null +++ b/.local/share/nvim/plugged/nnn.vim/LICENSE @@ -0,0 +1,26 @@ +BSD 2-Clause License + +Copyright (c) 2018-2019, Michael Chris Lopez +Copyright (c) 2018-2019, Arun Prakash Jana +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/.local/share/nvim/plugged/nnn.vim/README.md b/.local/share/nvim/plugged/nnn.vim/README.md new file mode 100644 index 0000000..985a59a --- /dev/null +++ b/.local/share/nvim/plugged/nnn.vim/README.md @@ -0,0 +1,126 @@ +# nnn.vim + +Fast and featureful file manager in vim/neovim powered by nnn. + +<p align="center"> + <img width="934" src="https://user-images.githubusercontent.com/7200153/50667041-7458f500-0ff2-11e9-887a-6443ee5d9344.png"> + <small>colorscheme <a href="https://github.com/nightsense/snow">snow</a></small> +</p> + +### Requirements + +1. nnn (minimum version 2.2) +2. Neovim or Vim 8.1 with terminal support + +### Install + +You must install nnn itself. Instructions +[here](https://github.com/jarun/nnn#installation). + +Then install using your favorite plugin manager: + +```vim +" using vim-plug +Plug 'mcchrish/nnn.vim' +``` + +### Usage + +To open nnn as a file picker in vim/neovim, use the command `:NnnPicker` or +`:Np` or the key-binding `<leader>n`. You can pass a directory to `:NnnPicker` +command and opens nnn from there e.g. `:NnnPicker path/to/somewhere`. + +Once you [select](https://github.com/jarun/nnn#selection) one or more files and +press <kbd>enter</kbd>, vim quits the nnn window and opens the first selected +file and add the remaining files to the arg list/buffer list. + +Pressing <kbd>enter</kbd> on a file in nnn will pick any earlier selection, pick +the file and exit nnn. + +To discard selection and exit, press <kbd>^G</kbd>. + +Please visit the complete documentation by running `:help nnn`. + +### Configurations + +#### Custom mappings + +```vim +" Disable default mappings +let g:nnn#set_default_mappings = 0 + +" Then set your own +nnoremap <silent> <leader>nn :NnnPicker<CR> + + +" Or override +" Start nnn in the current file's directory +nnoremap <leader>n :NnnPicker '%:p:h'<CR> +``` + +#### Layout + +```vim +" Opens the nnn window in a split +let g:nnn#layout = 'new' " or vnew, tabnew etc. + +" Or pass a dictionary with window size +let g:nnn#layout = { 'left': '~20%' } " or right, up, down +``` + +#### Action + +You can set extra key-bindings for opening files in different ways. Nothing is +set by default to not override nnn's own key-bindings. + +```vim +let g:nnn#action = { + \ '<c-t>': 'tab split', + \ '<c-x>': 'split', + \ '<c-v>': 'vsplit' } +``` + +For example, when inside an nnn window, pressing <kbd>ctrl-t</kbd> will open the +selected file in a tab, instead of the current window. <kbd>ctrl-x</kbd> will +open in a split an so on. Meanwhile for multi selected files will be loaded in +the buffer list. + +#### Command override + +When you want to override the default nnn command and add some extra flags. +Example you want to start nnn in light mode. + +```vim +let g:nnn#command = 'nnn -l' + +" or pass some env variables +let g:nnn#command = 'NNN_RESTRICT_NAV_OPEN=1 nnn -l' +``` + +#### `nnn#pick()` + +The `nnn#pick([<dir>][,<opts>])` function can be called with custom directory +and additional options such as opening file in splits or tabs. Basically a more +configurable version of `:NnnPicker` command. + +```vim +call nnn#pick('~/some-files', { 'edit': 'vertical split' }) +" Then you can do all kinds of mappings if you want +``` + +`opts` can be: + +- `edit` - type of window the select file will be open. +- `layout` - same as `g:nnn#layout` and overrides it if specified. + +#### Environment variables + +You can define env variables in `vimrc` and nnn will detect it. + +```vim +let $NNN_RESTRICT_NAV_OPEN=1 +``` + +### Credits + +Main nnn program: https://github.com/jarun/nnn diff --git a/.local/share/nvim/plugged/nnn.vim/autoload/nnn.vim b/.local/share/nvim/plugged/nnn.vim/autoload/nnn.vim new file mode 100644 index 0000000..2d42c86 --- /dev/null +++ b/.local/share/nvim/plugged/nnn.vim/autoload/nnn.vim @@ -0,0 +1,177 @@ +let s:temp_file = "" +let s:action = "" +let s:term_buff = 0 + +function! nnn#select_action(action) + let s:action = a:action + " quit nnn + if has("nvim") + call feedkeys("i\<cr>") + else + call term_sendkeys(s:term_buff, "\<cr>") + endif +endfunction + +function! s:create_on_exit_callback(opts) + let l:opts = a:opts + function! s:callback(id, code, ...) closure + if a:code != 0 + echohl ErrorMsg | echo 'nnn exited with '.a:code | echohl None + return + endif + + let l:opts.tbuf = bufnr('') + call s:eval_temp_file(l:opts) + endfunction + return function('s:callback') +endfunction + +function! s:present(dict, ...) + for key in a:000 + if !empty(get(a:dict, key, '')) + return 1 + endif + endfor + return 0 +endfunction + +function! s:calc_size(val, max) + let l:val = substitute(a:val, '^\~', '', '') + if val =~ '%$' + return a:max * str2nr(val[:-2]) / 100 + else + return min([a:max, str2nr(val)]) + endif +endfunction + +function! s:eval_layout(layout) + if type(a:layout) == 1 + return a:layout + endif + + let l:directions = { + \ 'up': ['topleft', 'resize', &lines], + \ 'down': ['botright', 'resize', &lines], + \ 'left': ['vertical topleft', 'vertical resize', &columns], + \ 'right': ['vertical botright', 'vertical resize', &columns] } + + for key in ['up', 'down', 'left', 'right'] + if s:present(a:layout, key) + let l:size = a:layout[key] + let [l:cmd, l:resz, l:max]= l:directions[key] + return l:cmd . s:calc_size(l:size, l:max) . 'new' + endif + endfor + throw 'Invalid layout' +endfunction + +function! s:switch_back(opts, Cmd) + let l:buf = a:opts.ppos.buf + let l:layout = a:opts.layout + let l:tbuf = a:opts.tbuf + + " when split explorer + if type(l:layout) == 1 && l:layout == 'enew' && bufexists(l:buf) + execute 'keepalt b' l:buf + if bufexists(l:tbuf) + execute 'bdelete!' l:tbuf + endif + endif + + " don't switch when action = 'edit' and just retain the window + " don't switch when layout = 'enew' for split explorer feature + if (type(a:Cmd) == 1 && a:Cmd != 'edit') + \ || (type(l:layout) != 1 + \ || (type(l:layout) == 1 && l:layout != 'enew')) + if bufexists(l:tbuf) + execute 'bdelete!' l:tbuf + endif + execute 'tabnext' a:opts.ppos.tab + execute a:opts.ppos.win.'wincmd w' + endif +endfunction + +function! s:extract_filenames() + if !filereadable(s:temp_file) + return [] + endif + + let l:file = readfile(s:temp_file) + if empty(l:file) + return [] + endif + + let l:names = uniq(filter(split(l:file[0], "\\n"), '!isdirectory(v:val)')) + if empty(l:names) || strlen(l:names[0]) <= 0 + return [] + endif + + return l:names +endfunction + +function! s:eval_temp_file(opts) abort + let l:tbuf = a:opts.tbuf + let l:Cmd = type(s:action) == 2 || strlen(s:action) > 0 ? s:action : a:opts.edit + + call s:switch_back(a:opts, l:Cmd) + + let l:names = s:extract_filenames() + " When exiting without any selection + if empty(l:names) + return + endif + + " Action passed is function + if (type(l:Cmd) == 2) + call l:Cmd(l:names) + else + " Edit the first item. + execute 'silent' l:Cmd fnameescape(l:names[0]) + " Add any remaining items to the arg list/buffer list. + for l:name in l:names[1:] + execute 'silent argadd' fnameescape(l:name) + endfor + endif + + let s:action = "" " reset action + + if bufexists(l:tbuf) + execute 'bdelete!' l:tbuf + endif + redraw! +endfunction + +function! s:statusline() + setlocal statusline=%#StatusLineTerm#\ nnn\ %#StatusLineTermNC# +endfunction + +function! nnn#pick(...) abort + let l:directory = expand(get(a:, 1, "")) + let l:default_opts = { 'edit': 'edit' } + let l:opts = extend(l:default_opts, get(a:, 2, {})) + let s:temp_file = tempname() + let l:cmd = g:nnn#command.' -p '.shellescape(s:temp_file).' '.expand(l:directory) + let l:layout = exists('l:opts.layout') ? l:opts.layout : g:nnn#layout + + let l:opts.layout = l:layout + let l:opts.ppos = { 'buf': bufnr(''), 'win': winnr(), 'tab': tabpagenr() } + execute s:eval_layout(l:layout) + + let l:On_exit = s:create_on_exit_callback(l:opts) + + if has("nvim") + call termopen(l:cmd, {'on_exit': function(l:On_exit) }) + startinsert + else + let s:term_buff = term_start([&shell, &shellcmdflag, l:cmd], {'curwin': 1, 'exit_cb': function(l:On_exit)}) + if !has('patch-8.0.1261') && !has('nvim') + call term_wait(s:term_buff, 20) + endif + endif + setf nnn + if g:nnn#statusline + call s:statusline() + endif +endfunction + +" vim: set sts=4 sw=4 ts=4 et : diff --git a/.local/share/nvim/plugged/nnn.vim/doc/nnn.txt b/.local/share/nvim/plugged/nnn.vim/doc/nnn.txt new file mode 100644 index 0000000..ed5b1bf --- /dev/null +++ b/.local/share/nvim/plugged/nnn.vim/doc/nnn.txt @@ -0,0 +1,201 @@ +*nnn.vim* nnn file manager plugin for vim/neovim. +*nnn* +> + __ __ __ __ __ __ __ __ __ __ __ + /\ "-.\ \ /\ "-.\ \ /\ "-.\ \ /\ \ / / /\ \ /\ "-./ \ + \ \ \-. \ \ \ \-. \ \ \ \-. \ \ \ \'/ \ \ \ \ \ \-./\ \ + \ \_\\"\_\ \ \_\\"\_\ \ \_\\"\_\ \ \__| \ \_\ \ \_\ \ \_\ + \/_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_/ +< + +============================================================================= +CONTENTS *nnn-help* + + Introduction .......................... |nnn-intro| + Requirements .......................... |nnn-req| + Usage ................................. |nnn-usage| + Commands .............................. |nnn-commands| + Mappings .............................. |nnn-mappings| + Configurations ........................ |nnn-config| + Functions ............................. |nnn-func| + Miscellaneous ......................... |nnn-misc| + Credits ............................... |nnn-credits| + +============================================================================= +Introduction *nnn-intro* + +This plugins attempts to make nnn the file manager companion for vim. Use it +to create, remove, move files or to quickly select files in nnn and open them +in vim all without leaving vim. It achieves these but utilizing the built-in +terminal feature of vim and neovim. + +----------------------------------------------------------------------------- +Requirements *nnn-req* + +1. nnn (minimum version 2.2) +2. Neovim or Vim 8.1 with terminal support + +============================================================================= +Usage *nnn-usage* + +By running |:NnnPicker| or calling the |nnn#pick()| function, a new terminal +buffer opens running an nnn process in picker mode. + +Once you select (see https://github.com/jarun/nnn#selection) one or more +files and press enter, vim quits the nnn window and opens the first selected +file and add the remaining files to the arg list/buffer list. + +Pressing enter on a file in nnn will pick any earlier selection, pick +the file and exit nnn. + +To discard selection and exit, press ^G. + +----------------------------------------------------------------------------- +Commands *nnn-commands* + +:NnnPicker *:NnnPicker* + Opens an nnn window. +:Np *:Np* + Does the same as :NnnPicker. + +----------------------------------------------------------------------------- +Mappings *nnn-mappings* + +Defaults mappings. Can be disabled by setting |g:nnn#set_default_mappings| to +0. + +<leader>n + Runs |:NnnPicker|. + +----------------------------------------------------------------------------- +Configurations *nnn-config* + +g:nnn#set_default_mappings *g:nnn#set_default_mappings* + Default: 1 + Enable default mappings. + Examples: +> + " Disable default mappings + let g:nnn#set_default_mappings = 0 + + " Set your own + nnoremap <silent> <leader>nn :NnnPicker<CR> + + + " Or override + " Start nnn in the current file's directory + nnoremap <leader>n :NnnPicker '%:p:h'<CR> +< + +g:nnn#layout *g:nnn#layout* + Default: 'enew' + Display type for the nnn buffer. Default is |enew|, which + has a special behavior to act as a "split explorer" reusing + the current window and brings back the last buffer if + nothing is selected. + Examples: +> + " Opens the nnn window in a split + let g:nnn#layout = 'new' " or vnew, tabnew etc. + + " Or pass a dictionary with window size + let g:nnn#layout = { 'left': '~20%' } " or right, up, down +< + +g:nnn#action *g:nnn#action* + Default: {} + Additional key-binding set for the nnn buffer for opening + files in different ways. Nothing is set by default to not + override nnn's own key-bindings. + Examples: +> + let g:nnn#action = { + \ '<c-t>': 'tab split', + \ '<c-x>': 'split', + \ '<c-v>': 'vsplit', + \ '<c-o>': function('CopyLinestoRegister') } + + For example, when inside an nnn window, pressing <C-t> will + open the selected file in a tab, instead of the current + window. <C-x> will open in a split an so on. Meanwhile for + multi selected files will be loaded in the buffer list. + + And finally you can pass a FuncRef and the array of selected + lines will be passed to that function. + + function! CopyLinestoRegister(lines) + let joined_lines = join(a:lines, "\n") + if len(a:lines) > 1 + let joined_lines .= "\n" + endif + echom joined_lines + let @+ = joined_lines + endfunction +< + +g:nnn#command *g:nnn#command* + Default: 'nnn' + When you want to override the default nnn command and add + some extra flags. + Example you want to start nnn in light mode. +> + let g:nnn#command = 'nnn -l' + + " or pass some env variables + let g:nnn#command = 'NNN_RESTRICT_NAV_OPEN=1 nnn -l' +< + +g:nnn#replace_netrw *g:nnn#replace_netrw* + Default: 0 + Open nnn instead of netrw when opening a directory. + + +g:nnn#statusline *g:nnn#statusline* + Default: 1 + The nnn statusline. Set to 0 to disable. + + +----------------------------------------------------------------------------- +Functions *nnn-func* + +nnn#pick([{dir}][,{opts}]) *nnn#pick()* + Can be called with custom directory and additional options + such as opening file in splits or tabs. Basically a more + configurable version of |:NnnPicker| command. + + {dir} : (string) a directory. + {opts}: (dict) can be: + edit : type of window the select file will be open. Or + pass a FuncRef and array of selected files will be + passed to that function. + layout: same as |g:nnn#layout| and overrides it if + specified. + + Example: +> + call nnn#pick('~/some-files', { 'edit': 'vertical split' }) +< + +============================================================================= +Miscellaneous *nnn-misc* + +You can define env variables in `vimrc` and nnn will detect it. +> + let $NNN_RESTRICT_NAV_OPEN=1 +< + +============================================================================= +Credits *nnn-credits* + +Main nnn program by Arun Prakash Jana +github: https://github.com/jarun + +Vim/neovim plugin maintained by Michael Chris Lopez +gitub: https://github.com/mcchrish + +Source codes: +nnn: https://github.com/jarun/nnn +vim plugin: https://github.com/mcchrish/nnn.vim + +============================================================================= +vim:tw=78:ts=2:et:ft=help:norl: diff --git a/.local/share/nvim/plugged/nnn.vim/doc/tags b/.local/share/nvim/plugged/nnn.vim/doc/tags new file mode 100644 index 0000000..4ca5091 --- /dev/null +++ b/.local/share/nvim/plugged/nnn.vim/doc/tags @@ -0,0 +1,21 @@ +:NnnPicker nnn.txt /*:NnnPicker* +:Np nnn.txt /*:Np* +g:nnn#action nnn.txt /*g:nnn#action* +g:nnn#command nnn.txt /*g:nnn#command* +g:nnn#layout nnn.txt /*g:nnn#layout* +g:nnn#replace_netrw nnn.txt /*g:nnn#replace_netrw* +g:nnn#set_default_mappings nnn.txt /*g:nnn#set_default_mappings* +g:nnn#statusline nnn.txt /*g:nnn#statusline* +nnn nnn.txt /*nnn* +nnn#pick() nnn.txt /*nnn#pick()* +nnn-commands nnn.txt /*nnn-commands* +nnn-config nnn.txt /*nnn-config* +nnn-credits nnn.txt /*nnn-credits* +nnn-func nnn.txt /*nnn-func* +nnn-help nnn.txt /*nnn-help* +nnn-intro nnn.txt /*nnn-intro* +nnn-mappings nnn.txt /*nnn-mappings* +nnn-misc nnn.txt /*nnn-misc* +nnn-req nnn.txt /*nnn-req* +nnn-usage nnn.txt /*nnn-usage* +nnn.vim nnn.txt /*nnn.vim* diff --git a/.local/share/nvim/plugged/nnn.vim/ftplugin/nnn.vim b/.local/share/nvim/plugged/nnn.vim/ftplugin/nnn.vim new file mode 100644 index 0000000..5e3ae2a --- /dev/null +++ b/.local/share/nvim/plugged/nnn.vim/ftplugin/nnn.vim @@ -0,0 +1,17 @@ +if exists("g:nnn_ftplugin") + finish +endif +let b:nnn_ftplugin = 1 + +let s:nowait = (v:version > 703 ? '<nowait>' : '') + +for key in keys(g:nnn#action) + if type(g:nnn#action[key]) == 2 + exec 'tnoremap '.s:nowait.'<buffer><silent> '.key.' <c-\><c-n>:<c-u>call nnn#select_action('.string(g:nnn#action[key]).')<cr>' + else + exec 'tnoremap '.s:nowait.'<buffer><silent> '.key.' <c-\><c-n>:<c-u>call nnn#select_action("'.g:nnn#action[key].'")<cr>' + endif +endfor + +setlocal nospell bufhidden=wipe nobuflisted nonumber noruler +" vim: set sts=4 sw=4 ts=4 et : diff --git a/.local/share/nvim/plugged/nnn.vim/plugin/nnn.vim b/.local/share/nvim/plugged/nnn.vim/plugin/nnn.vim new file mode 100644 index 0000000..8ea13d0 --- /dev/null +++ b/.local/share/nvim/plugged/nnn.vim/plugin/nnn.vim @@ -0,0 +1,51 @@ +if exists('g:nnn#loaded') + finish +endif +let g:nnn#loaded = 1 + +if !(exists("g:nnn#set_default_mappings")) + let g:nnn#set_default_mappings = 1 +endif + +if !(exists("g:nnn#layout")) + let g:nnn#layout = 'enew' +endif + +if !(exists("g:nnn#action")) + let g:nnn#action = {} +endif + +if !(exists("g:nnn#command")) + let g:nnn#command = 'nnn' +endif + +if !(exists("g:nnn#replace_netrw")) + let g:nnn#replace_netrw = 0 +endif + +if !(exists("g:nnn#statusline")) + let g:nnn#statusline = 1 +endif + +command! -bar -nargs=? -complete=dir NnnPicker call nnn#pick(<f-args>) +command! -bar -nargs=? -complete=dir Np call nnn#pick(<f-args>) + +if g:nnn#set_default_mappings + nnoremap <silent> <leader>n :NnnPicker<CR> +endif + +" To open nnn when vim load a directory +if g:nnn#replace_netrw + function! s:nnn_pick_on_load_dir(argv_path) + let l:path = expand(a:argv_path) + bdelete! + call nnn#pick(l:path) + endfunction + + augroup ReplaceNetrwByNnnVim + autocmd VimEnter * silent! autocmd! FileExplorer + autocmd BufEnter * if isdirectory(expand("%")) | call <SID>nnn_pick_on_load_dir("%") | endif + augroup END +endif + +" vim: set sts=4 sw=4 ts=4 et : |