host.vim: s:GetManifestPath(): Remove for-loop.

Without the for-loop it is easier to follow, more explicit, and fewer
lines.
This commit is contained in:
Justin M. Keyes 2016-08-17 17:30:17 -04:00
parent 966f1abd8b
commit 4b0b391f9f
2 changed files with 13 additions and 19 deletions

View File

@ -126,23 +126,17 @@ function! s:GetManifestPath() abort
return fnamemodify($NVIM_RPLUGIN_MANIFEST, ':p') return fnamemodify($NVIM_RPLUGIN_MANIFEST, ':p')
endif endif
let preferred = has('win32') let dest = has('win32') ? '$LOCALAPPDATA' : '$XDG_DATA_HOME'
\ ? ['$LOCALAPPDATA', '~/AppData/Local'] if !exists(dest)
\ : ['$XDG_DATA_HOME', '~/.local/share'] let dest = has('win32') ? '~/AppData/Local' : '~/.local/share'
endif
for dest in preferred let dest = fnamemodify(expand(dest), ':p')
if dest[0] == '$' && !exists(dest) if !empty(dest) && isdirectory(dest)
continue let dest .= 'nvim/'
endif call mkdir(dest, 'p', 700)
let manifest_base = dest
let dest = fnamemodify(expand(dest), ':p') endif
if !empty(dest) && isdirectory(dest)
let dest .= 'nvim/'
call mkdir(dest, 'p', 700)
let manifest_base = dest
break
endif
endfor
return manifest_base.'rplugin.vim' return manifest_base.'rplugin.vim'
endfunction endfunction

View File

@ -130,9 +130,9 @@ like this: It's a way to provide IDE capabilities in Nvim while still keeping
it fast and lightweight for general use. It's also analogous to the |:helptags| it fast and lightweight for general use. It's also analogous to the |:helptags|
command. command.
Unless a path is set in the `$NVIM_RPLUGIN_MANIFEST` environment variable, the *$NVIM_RPLUGIN_MANIFEST*
manifest will be written to a file named `rplugin.vim` in one of the following Unless $NVIM_RPLUGIN_MANIFEST is set the manifest will be written to a file
directories: named `rplugin.vim` at:
Unix ~ Unix ~
$XDG_DATA_HOME/nvim/ or ~/.local/share/nvim/ $XDG_DATA_HOME/nvim/ or ~/.local/share/nvim/