File: env_reload.vim

package info (click to toggle)
vim-addon-mw-utils 0.2-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 132 kB
  • sloc: makefile: 2
file content (12 lines) | stat: -rw-r--r-- 504 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
" in sh/bash you can type export to get a list of environment variables
" This function assigns those env vars to Vim.
" Does not delete env vars yet
" Example: env_reload#ReloadEnv(system("sh -c 'export'")
fun! env_reload#ReloadEnv(bash_export_command_output)
  for i in split(a:bash_export_command_output,"\n")
    let m = matchlist(i, 'export \([^=]\+\)="\(.*\)"')
    if empty(m) | continue | endif
    " don't care about quoted values right now.
    exec 'let $'.m[1].'='.string(m[2])
  endfor
endf