Skip to content

Commit

Permalink
Use notmuch config command
Browse files Browse the repository at this point in the history
This simplifies the configuration parsing.

Based on code by Ian Main.

Signed-off-by: Felipe Contreras <[email protected]>
  • Loading branch information
felipec committed Apr 17, 2021
1 parent f99211d commit 53ff970
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions plugin/notmuch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -504,17 +504,9 @@ ruby << EOF
$mail_installed = defined?(Mail)

def get_config
group = nil
config = ENV['NOTMUCH_CONFIG'] || '~/.notmuch-config'
File.open(File.expand_path(config)).each do |l|
l.chomp!
case l
when /^\[(.*)\]$/
group = $1
when ''
when /^(.*)=(.*)$/
key = "%s.%s" % [group, $1]
value = $2
IO.popen(%w[notmuch config list]) do |io|
io.each(chomp: true) do |e|
key, value = e.split('=')
$config[key] = value
end
end
Expand Down

0 comments on commit 53ff970

Please sign in to comment.