1

Update generated neovim config

This commit is contained in:
2024-08-15 14:28:54 +02:00
parent 07409c223d
commit 25cfcf2941
3809 changed files with 351157 additions and 0 deletions

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 zimbatm and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,29 @@
direnv.vim - yup
================
This plugin aim is to integrate [Direnv][direnv] and (Neo)Vim. Because Vim can
shell out to other tools it's nice if the environment is in sync with the usual
shell.
See detail in the [doc][].
Install
-------
Clone the repository to load by [packages][].
```sh
git clone https://github.com/direnv/direnv.vim \
~/.vim/pack/foo/start/direnv.vim
```
Or use your favorite plugin manager.
TODO
----
- Allow/deny authorization mechanism.
[direnv]: https://direnv.net
[packages]: https://vimhelp.org/repeat.txt.html#packages
[doc]: https://github.com/direnv/direnv.vim/blob/master/doc/direnv.txt

View File

@ -0,0 +1,138 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: zimbatm <http://zimbatm.com/> & Hauleth <lukasz@niemier.pl>
" Version: 0.3
scriptencoding utf-8
let s:direnv_cmd = get(g:, 'direnv_cmd', '/nix/store/1mrvvx2ygfyfz8sn3gg5f3qidvd9s8j1-direnv-2.34.0/bin/direnv')
let s:direnv_interval = get(g:, 'direnv_interval', 500)
let s:direnv_max_wait = get(g:, 'direnv_max_wait', 5)
let s:direnv_auto = get(g:, 'direnv_auto', 1)
let s:job_status = { 'running': 0, 'stdout': [], 'stderr': [] }
if !exists('g:direnv_silent_load')
let g:direnv_silent_load = 0
endif
function! direnv#auto() abort
return s:direnv_auto
endfunction
function! direnv#post_direnv_load() abort
call direnv#extra_vimrc#load()
doautocmd User DirenvLoaded
endfunction
function! direnv#on_stdout(_, data, ...) abort
if a:data != ['']
call extend(s:job_status.stdout, a:data)
end
endfunction
function! direnv#on_stderr(_, data, ...) abort
if a:data != ['']
call extend(s:job_status.stderr, a:data)
end
endfunction
function! direnv#on_exit(_, status, ...) abort
let s:job_status.running = 0
if !g:direnv_silent_load
for l:m in s:job_status.stderr
if l:m isnot# ''
echom l:m
endif
endfor
endif
exec join(s:job_status.stdout, "\n")
call direnv#post_direnv_load()
endfunction
function! direnv#job_status_reset() abort
let s:job_status['stdout'] = []
let s:job_status['stderr'] = []
endfunction
function! direnv#err_cb(_, data) abort
call direnv#on_stderr(0, split(a:data, "\n", 1))
endfunction
function! direnv#out_cb(_, data) abort
call direnv#on_stdout(0, split(a:data, "\n", 1))
endfunction
function! direnv#exit_cb(_, status) abort
call direnv#on_exit(0, a:status)
endfunction
if has('nvim')
let s:job =
\ {
\ 'on_stdout': 'direnv#on_stdout',
\ 'on_stderr': 'direnv#on_stderr',
\ 'on_exit': 'direnv#on_exit'
\ }
else
let s:job =
\ {
\ 'out_cb': 'direnv#out_cb',
\ 'err_cb': 'direnv#err_cb',
\ 'exit_cb': 'direnv#exit_cb'
\ }
endif
function! direnv#export() abort
call s:export_debounced.do()
endfunction
function! direnv#export_core() abort
if !executable(s:direnv_cmd)
echom 'No Direnv executable, add it to your PATH or set correct g:direnv_cmd'
return
endif
let l:cmd = [s:direnv_cmd, 'export', 'vim']
if has('nvim')
call jobstart(l:cmd, s:job)
elseif has('job') && has('channel')
if !has('timers')
if s:job_status.running
return
endif
let s:job_status.running = 1
endif
call direnv#job_status_reset()
call job_start(l:cmd, s:job)
else
let l:tmp = tempname()
echom system(printf(join(l:cmd).' '.&shellredir, l:tmp))
exe 'source '.l:tmp
call delete(l:tmp)
call direnv#post_direnv_load()
endif
endfunction
let s:export_debounced = {'id': 0, 'counter': 0}
if has('timers')
function! s:export_debounced.call(...)
let self.id = 0
let self.counter = 0
call direnv#export_core()
endfunction
function! s:export_debounced.do()
call timer_stop(self.id)
if self.counter < s:direnv_max_wait
let self.counter = self.counter + 1
let self.id = timer_start(s:direnv_interval, self.call)
else
call self.call()
endif
endfunction
else
function! s:export_debounced.do()
call direnv#export_core()
endfunction
endif

View File

@ -0,0 +1,56 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: JINNOUCHI Yasushi <me@delphinus.dev>
" Version: 0.2
let s:direnv_edit_mode = get(g:, 'direnv_edit_mode', 'edit')
function! direnv#edit#envrc() abort
if $DIRENV_DIR !=# ''
let l:envrc_dir = substitute($DIRENV_DIR, '^-', '', '')
else
let l:envrc_dir = getcwd()
endif
let l:envrc = l:envrc_dir . '/.envrc'
if !filereadable(l:envrc)
echom 'new .envrc file will be created:' l:envrc_dir
endif
call direnv#edit#execute(l:envrc)
endfunction
function! direnv#edit#direnvrc() abort
if $XDG_CONFIG_HOME ==# ''
let l:direnvrc_dir = $HOME . '/.config/direnv'
else
let l:direnvrc_dir = $XDG_CONFIG_HOME . '/direnv'
endif
if filereadable(l:direnvrc_dir . '/direnvrc')
let l:direnvrc = l:direnvrc_dir . '/direnvrc'
elseif filereadable($HOME . '/.direnvrc')
let l:direnvrc = $HOME . '/.direnvrc'
else
let l:direnvrc = l:direnvrc_dir . '/direnvrc'
if !isdirectory(l:direnvrc_dir)
let l:result = direnv#edit#mkdir(l:direnvrc_dir)
if !l:result
echoerr 'Vim cannot create the directory:' l:direnvrc_dir
return
endif
endif
endif
if !filereadable(l:direnvrc)
echom 'new direnvrc file will be created:' l:direnvrc
endif
call direnv#edit#execute(l:direnvrc)
endfunction
function! direnv#edit#mkdir(dir) abort
if !exists('*mkdir')
return 0
endif
let l:result = mkdir(a:dir, 'p', 0700)
return l:result
endfunction
function! direnv#edit#execute(file) abort
execute ':' . s:direnv_edit_mode a:file
endfunction

View File

@ -0,0 +1,28 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: JINNOUCHI Yasushi <me@delphinus.dev>
" Version: 0.2
" load() sources local vimrc's described in $EXTRA_VIMRC
function! direnv#extra_vimrc#load() abort
let b:direnv_loaded_extra_vimrcs = get(b:, 'direnv_loaded_extra_vimrcs', {})
if $DIRENV_EXTRA_VIMRC !=# ''
for l:path in split($DIRENV_EXTRA_VIMRC, ':')
if filereadable(l:path) && !has_key(b:direnv_loaded_extra_vimrcs, l:path)
execute 'source' l:path
let b:direnv_loaded_extra_vimrcs[l:path] = 1
endif
endfor
endif
endfunction
" check() checks $DIRENV_DIR and call load()
function! direnv#extra_vimrc#check() abort
if $DIRENV_DIR !=# ''
let l:filedir = expand('%:p:h')
let l:direnv_dir = substitute($DIRENV_DIR, '^-', '', '')
" TODO think about Windows?
if stridx(l:filedir, l:direnv_dir) == 0
call direnv#post_direnv_load()
endif
endif
endfunction

View File

@ -0,0 +1,167 @@
*direnv.txt* Plugin to integrate Direnv and (Neo)Vim
Author: zimbatm <http://zimbatm.com/>
delphinus <me@delphinus.dev>
License: MIT License
=============================================================================
CONTENTS *direnv-contents*
INTRODUCTION |direnv-introduction|
INSTALLATION |direnv-installation|
EXTRA VIMRC |direnv-installation|
COMMANDS |direnv-commands|
CONFIGURATION |direnv-configuration|
CAVEATS |direnv-caveats|
=============================================================================
INTRODUCTION *direnv-introduction*
This plugin aim is to integrate Direnv and (Neo)Vim.
*direnv-introduction-features*
Features~
* Run Direnv's hook appropriately every when Vim changes its current
directory.
* Run your local `.vimrc` in the current directory when `use vim` directive
exists in `.envrc`.
* Add |ftdetect|, |ftplugin|, and |syntax| to make easy to write your own `.envrc`'s.
=============================================================================
INSTALLATION *direnv-installation*
Clone the repository to load by |packages|.
*direnv-installation-forvim*
For Vim~
>
git clone https://github.com/direnv/direnv.vim \
~/.vim/pack/foo/start/direnv.vim
<
*direnv-installation-forneovim*
For Neovim~
>
git clone https://github.com/direnv/direnv.vim \
~/.local/share/nvim/site/pack/foo/start/direnv.vim
Or you can use any plugin manager you like.
=============================================================================
EXTRA VIMRC *direnv-extravimrc*
When you use `use vim` directive in the `.envrc`, you can source `.vimrc.local`
(in default) in changing the current directory of Vim.
>
# in your .envrc (Direnv settings)
use vim
# you can set your own filename
use vim .my-vimrc
With `use vim` directives, Direnv sets the paths in `$DIRENV_EXTRA_VIMRC`
environmental variable. This plugin reads the variable and sources them.
Internally, this plugin remembers the sourced filenames and does not source it
again even when `DirenvExport` is called in the same buffer.
NOTE: Unlike the other features of Direnv, this “sourcing” is irreversible.
You should NOT change settings globally in your `.vimrc.local` because it
affects other windows/buffers.
>
" in your .vimrc.local
" This sets the value only for the window you are in.
setlocal scrolloff=3
" Also set buffer-local variable for this use.
let b:ale_fixers = ['prettier', 'eslint']
=============================================================================
COMMANDS *direnv-commands*
`:DirenvExport` *direnv-commands-direnvexport*
Run the Direnv command and load the valid settings. This command will be
executed automatically (and asynchronously) by |autocmd| events in default.
NOTE: The kind of events this command will be called depends on your (Neo)
Vim's version. See |direnv-caveats|.
`:EditDirenvrc` *direnv-commands-editdirenvrc*
Open the global setting file for the Direnv command. This searches files
ordered below.
* `$XDG_CONFIG_HOME/direnv/direnvrc`
* `~/.config/direnv/direnvrc`
* `~/.direnvrc`
`:EditEnvrc` *direnv-commands-editenvrc*
Open the detected `.envrc` if found or a new buffer to edit `.envrc` on the
current directory otherwise.
=============================================================================
CONFIGURATION *direnv-configuration*
All configuration variables must be set before loading the plugin (typically
in your `.vimrc` or `init.vim`).
`g:direnv_auto` *direnv-configuration-direnvauto*
It will not execute |direnv-commands-direnvexport| automatically if the value
is `0`. Default: `1`.
>
" Call DirenvExport on your demand
let g:direnv_auto = 0
`g:direnv_edit_mode` *direnv-configuration-direnveditmode*
Select the command to open buffers to edit. Default: `'edit'`.
>
" split the window before editing files
let g:direnv_edit_mode = 'split'
" split vertically
let g:direnv_edit_mode = 'vsplit'
`g:direnv_silent_load` *direnv-configuration-direnvsilentload*
Stop echoing output from Direnv command. Default: `0`.
>
" Silently call the Direnv command
let g:direnv_silent_load = 1
=============================================================================
AUTOCMD EVENTS *direnv-autocmdevents*
`DirenvLoaded` *direnv-autocmdevents-direnvloaded*
This plugin calls this |User| event just after sourcing extra vimrc (See
|direnv-extravimrc|).
>
" Announce when loaded extra vimrc's
autocmd User DirenvLoaded :echo 'loaded extra vimrc'
=============================================================================
CAVEATS *direnv-caveats*
Environmental variable keys~
The Vimscript syntax seems to limit keys to alphanumeric characters. If any
environmental variable key is something different, the plugin might fail.
Autocmd events to be called~
The newer Vim builds (>8.0.1459) & Neovim have |Dirchanged| that is fired on
directory changes. Direnv command will be fired only on |VimEnter| &
|DirChanged| with them.
For older Vim's, there is a fallback that it fires on each |BufEnter|. This is
not an ideal solution, but for now we have no other solutions.
Asynchronous loading~
Due to asynchronous calls for Direnv, it can happen that variables from
`.envrc` will not be available yet, if you work too fast.
=============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl

View File

@ -0,0 +1,19 @@
direnv-autocmdevents direnv.txt /*direnv-autocmdevents*
direnv-autocmdevents-direnvloaded direnv.txt /*direnv-autocmdevents-direnvloaded*
direnv-caveats direnv.txt /*direnv-caveats*
direnv-commands direnv.txt /*direnv-commands*
direnv-commands-direnvexport direnv.txt /*direnv-commands-direnvexport*
direnv-commands-editdirenvrc direnv.txt /*direnv-commands-editdirenvrc*
direnv-commands-editenvrc direnv.txt /*direnv-commands-editenvrc*
direnv-configuration direnv.txt /*direnv-configuration*
direnv-configuration-direnvauto direnv.txt /*direnv-configuration-direnvauto*
direnv-configuration-direnveditmode direnv.txt /*direnv-configuration-direnveditmode*
direnv-configuration-direnvsilentload direnv.txt /*direnv-configuration-direnvsilentload*
direnv-contents direnv.txt /*direnv-contents*
direnv-extravimrc direnv.txt /*direnv-extravimrc*
direnv-installation direnv.txt /*direnv-installation*
direnv-installation-forneovim direnv.txt /*direnv-installation-forneovim*
direnv-installation-forvim direnv.txt /*direnv-installation-forvim*
direnv-introduction direnv.txt /*direnv-introduction*
direnv-introduction-features direnv.txt /*direnv-introduction-features*
direnv.txt direnv.txt /*direnv.txt*

View File

@ -0,0 +1,5 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: JINNOUCHI Yasushi <me@delphinus.dev>
" Version: 0.2
autocmd BufRead,BufNewFile .envrc*,.direnvrc*,direnvrc* setfiletype direnv

View File

@ -0,0 +1,15 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: JINNOUCHI Yasushi <me@delphinus.dev>
" Version: 0.2
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
setlocal commentstring=#\ %s
augroup direnv-buffer
autocmd! * <buffer>
autocmd BufWritePost <buffer> DirenvExport
augroup END

View File

@ -0,0 +1,37 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: zimbatm <http://zimbatm.com/> & Hauleth <lukasz@niemier.pl>
" Version: 0.2
if exists('g:loaded_direnv') || &compatible || v:version < 700
finish
endif
let g:loaded_direnv = 1
" MacVim (vim 8.0) with patches 1-1272 throws an error if a job option is given
" extra fields that it does not recognize. If the job ran even with the error
" message, this could be fixed with `silent!`, but the job doesn't run.
"
" To fix this, we give `vim` an empty `s:job` dictionary that calls back to the
" `s:job_status` dictionary. `nvim` gets `s:job` set as `s:job_status`.
command! -nargs=0 DirenvExport call direnv#export()
command! -nargs=0 EditDirenvrc call direnv#edit#direnvrc()
command! -nargs=0 EditEnvrc call direnv#edit#envrc()
if direnv#auto()
augroup direnv_rc
au!
autocmd VimEnter * DirenvExport
autocmd BufEnter * call direnv#extra_vimrc#check()
" need this to avoid an error on loading
autocmd User DirenvLoaded :
if exists('##DirChanged')
autocmd DirChanged * DirenvExport
else
autocmd BufEnter * DirenvExport
endif
augroup END
endif
" vi: fdm=marker sw=2 sts=2 et

View File

@ -0,0 +1,89 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: JINNOUCHI Yasushi <me@delphinus.dev>
" Version: 0.2
if exists('b:current_syntax')
finish
endif
" To use syntax for bash in sh.vim, set the g:is_bash value temporarily.
let s:current = get(g:, 'is_bash', '__NO_VALUE__')
let g:is_bash = 1
runtime! syntax/sh.vim
if s:current ==# '__NO_VALUE__'
unlet g:is_bash
else
let g:is_bash = s:current
endif
unlet s:current
let b:current_syntax = 'direnv'
" Func: with commands {{{
" `has` func takes one argument that represents a CLI command.
syn keyword direnvCommandFunc has nextgroup=direnvCommand,shSingleQuote,shDoubleQuote skipwhite
hi def link direnvCommandFunc shStatement
" command name is almost the same as direnvPath, but has a different color.
syn region direnvCommand start=/[^'"[:space:]]/ skip=/\\./ end=/\([][(){}#`'";\\[:space:]]\)\@=\|$/ contained nextgroup=shComment skipwhite
hi def link direnvCommand shCommandSub
" }}}
" Func: with paths {{{
" These funcs takes one argument that represents a file/dir path.
syn keyword direnvPathFunc dotenv dotenv_if_exists env_vars_required fetchurl join_args user_rel_path on_git_branch find_up has source_env source_env_if_exists source_up source_up_if_exists source_url PATH_add MANPATH_add load_prefix watch_file watch_dir semver_search strict_env unstrict_env nextgroup=direnvPath,shSingleQuote,shDoubleQuote skipwhite
hi def link direnvPathFunc shStatement
" path string can end before non-escaped [, ], (, ), {, }, #, `, ', ", ;, \, and spaces.
syn region direnvPath start=/[^'"[:space:]]/ skip=/\\./ end=/\([][(){}#`'";\\[:space:]]\)\@=\|$/ contained nextgroup=shComment skipwhite
hi def link direnvPath Directory
" `expand_path` takes one or two arguments that represents a dir path.
syn keyword direnvExpandPathFunc expand_path nextgroup=direnvExpandPathRel,shSingleQuote,shDoubleQuote skipwhite
hi def link direnvExpandPathFunc shStatement
syn region direnvExpandPathRel start=/[^'"[:space:]]/ skip=/\\./ end=/\%(\s\|\_$\)/ contained nextgroup=direnvPath,shSingleQuote,shDoubleQuote skipwhite
hi def link direnvExpandPathRel Directory
" `path_add` takes two arguments that represents a variable name and a dir
" path.
syn keyword direnvPathAddFunc PATH_add MANPATH_add PATH_rm path_rm path_add nextgroup=direnvVar skipwhite
hi def link direnvPathAddFunc shStatement
syn match direnvVar /\S\+/ nextgroup=direnvPath,shSingleQuote,shDoubleQuote contained skipwhite
hi def link direnvVar shCommandSub
" }}}
" Func: use {{{
syn keyword direnvUseFunc use use_flake use_guix use_julia use_nix use_node use_nodenv use_rbenv use_vim rvm nextgroup=direnvUseCommand skipwhite
hi def link direnvUseFunc shStatement
" `use rbenv/nix/guix` takes several arguments.
syn match direnvUseCommand /\S\+/ contained
hi def link direnvUseCommand shCommandSub
" }}}
" Func: layout {{{
" `layout` takes one argument that represents a language name.
syn keyword direnvLayoutFunc layout layout_anaconda layout_go layout_julia layout_node layout_perl layout_php layout_pipenv layout_pyenv layout_python layout_python2 layout_python3 layout_ruby nextgroup=direnvLayoutLanguage,direnvLayoutLanguagePath skipwhite
hi def link direnvLayoutFunc shStatement
syn keyword direnvLayoutLanguage go node perl python3 ruby contained
hi def link direnvLayoutLanguage shCommandSub
" `layout python` takes one more argument that represents a file path.
syn keyword direnvLayoutLanguagePath python nextgroup=direnvPath,shSingleQuote,shDoubleQuote contained skipwhite
hi def link direnvLayoutLanguagePath shCommandSub
" }}}
" Func: others {{{
" `direnv_load` takes several arguments.
syn keyword direnvFunc direnv_apply_dump direnv_layout_dir direnv_load direnv_version log_error log_status
hi def link direnvFunc shStatement
" }}}
syn cluster direnvStatement contains=direnvCommandFunc,direnvPathFunc,direnvExpandPathFunc,direnvPathAddFunc,direnvUseFunc,direnvLayoutFunc,direnvFunc
syn cluster shArithParenList add=@direnvStatement
syn cluster shCommandSubList add=@direnvStatement
" vim:se fdm=marker: