Giter Site home page Giter Site logo

notmuch-vim's Introduction

notmuch vim

This is a vim plug-in that provides a fully usable mail client interface, utilizing the notmuch framework.

oo4yUOQDDF2CrWZbzhZURFtTW

Install

You can use any vim plugin manager:

% git clone https://github.com/felipec/notmuch-vim.git ~/.vim/pack/plugins/start/notmuch-vim

vim +ruby

Make sure your vim version has ruby support: check for +ruby in 'vim --version' features.

% vim --version | grep +ruby

ruby bindings

Check if you are able to run the following command cleanly:

% ruby -e "require 'notmuch'"

If you don’t see any errors it means it’s working and you can go to the next section, if not, you would need to compile the bindings yourself, or contact your distribution so they package notmuch correctly.

mail gem

Since libnotmuch library concentrates on things other than handling mail, we need a library to do that, and for Ruby the best library for that is called 'mail':

% gem install mail

This gem is not mandatory, but it’s extremely recommended.

Running

Simple:

% gvim -c ':NotMuch'

You might want to write a wrapper script (e.g. vnm)

#!/bin/sh
gvim -c ":NotMuch $*"

So you can run:

vnm is:inbox date:yesterday..

Enjoy ;)

More stuff

As an example to configure a key mapping to add the tag 'to-do' and archive, this is what I use:

let g:notmuch_custom_search_maps = {
	\ 't':		'search_tag("+to-do -inbox")',
	\ }

let g:notmuch_custom_show_maps = {
	\ 't':		'show_tag("+to-do -inbox")',
	\ }

notmuch-vim's People

Contributors

cehoffman avatar felipec avatar ff2000 avatar julow avatar kiryl avatar kitwestneat avatar paulmr avatar trosh avatar yeled avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

notmuch-vim's Issues

thread view: last message line not shown

In thread view I am not seeing the last message line of the last mail in the thread. Here's an example of an email that contains 3 message body lines:

<[email protected]> 30.05.24 10:20:50 (["inbox", "sent", "unread"])
Subject: Test from notmuch-nvim
To: <[email protected]>
Cc: 
Date: Thu, 30 May 2024 10:20:50 +0200
--- text/plain ---
First message line.
Second message line.

It should display Third message line. at the end.

I don't know what is causing the issue but here's a workaround that let it display the last line as well:

diff --git a/plugin/notmuch.vim b/plugin/notmuch.vim
index 238bea89f643..870e72c9c06f 100644
--- a/plugin/notmuch.vim
+++ b/plugin/notmuch.vim
@@ -358,6 +358,7 @@ ruby << EOF
                        b << ""
                        nm_m.end = b.count
                end
+               b << " "
                b.delete(b.count)
        end
        $messages.each_with_index do |msg, i|

My guess it that in this way it just inserts an additional " " line which won't be displayed.

Setup:

  • distro: Arch linux

  • notmuch: v0.38.3

  • notmuch-vim: at latest master commit: 4270c7e ("Fix configuration parsing bug")

  • neovim: v0.10.0

  • ruby deps:

    gem list | grep -e neovim -e mail 
    mail (2.8.1)
    neovim (0.9.1)
    

compatibility with Vundle

notmuch-vim-ruby currently does not work wen managed through Vundle. This can be easily achieved by creating a dir "plugin" and moving the notmuch.vim-file into there:

$ git mv notmuch.vim plugin

If you want I can create a pull request ;)

programmable colors

I like my text interfaces to be pretty and, in particular, solarized. While my default vim and terminal emulator configurations do a good job of using the solarized color palette, I would prefer to have more control over how the folder, search and show buffers display their colorized text. In particular I would like to color code threads in the search buffer based on tags (unread, to-me, flagged, etc).

Does vim provide all that I need to do this today or does notmuch-vim need some for this?

Dependency Failure: Ruby bindings broken on Mac OS?

I can't get the notmuch ruby bindings to work on Mac OS (El Capitan). So far, I've tried:

Homebrew

$ brew install notmuch

But ruby -e "require 'notmuch'" fails.

per the README

$ git clone --branch=0.15.2 git://notmuchmail.org/git/notmuch ~/notmuch
$ cd ~/notmuch
$ make build notmuch=~/notmuch
...
make: *** No rule to make target `build'.  Stop.

Naturally, ruby -e "require 'notmuch'" still fails.

Current git master

$ git clone git://notmuchmail.org/git/notmuch

Per bindings/ruby/README:

To build the the notmuch ruby extension, run the following commands
from the top level notmuch source directory:

% ./configure
% make ruby-bindings

The generic documentation about building notmuch also applies.

./configure fails on dependency zlib >=1.2.5.2 (system is 1.2.5). So, I installed 1.2.8 via rudix.

Now ./configure and make ruby-bindings succeed, but ruby -e "require 'notmuch'" still fails.

Instructions on @cehoffman's fork

Ruby Bindings

Go to notmuch source code, and then 'bindings/ruby':

% ruby extconf.rb
% make
% sudo make install
$ cd bindings/ruby
$ make install
/usr/bin/install -c -m 0755 notmuch.bundle /Users/rlue/.rbenv/versions/2.4.0/lib/ruby/vendor_ruby/2.4.0/x86_64-darwin15

Now ruby -e "require 'notmuch'" throws a different error:

/Users/rlue/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/rlue/.rbenv/versions/2.4.0/lib/ruby/vendor_ruby/2.4.0/x86_64-darwin15/notmuch.bundle, 9): Library not loaded: /usr/local/lib/libnotmuch.5.dylib (LoadError)
  Referenced from: /Users/rlue/.rbenv/versions/2.4.0/lib/ruby/vendor_ruby/2.4.0/x86_64-darwin15/notmuch.bundle
  Reason: image not found - /Users/rlue/.rbenv/versions/2.4.0/lib/ruby/vendor_ruby/2.4.0/x86_64-darwin15/notmuch.bundle
	from /Users/rlue/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from -e:1:in `<main>'

It appears it's trying to load /usr/local/lib/libnotmuch.5.dylib, which does not exist:

$ ls /usr/local/lib/libnotmuch.*
/usr/local/lib/libnotmuch.4.4.0.dylib
/usr/local/lib/libnotmuch.4.dylib
/usr/local/lib/libnotmuch.dylib

Any suggestions?

Configurable sort order when displaying search results

search_render() currently uses the hardcoded Notmuch::SORT_NEWEST_FIRST. I think it would be nice to make the sort order configurable for the end user, ideally on a per-search-basis. This would for example allow sorting messages tagged "inbox" oldest first, an those tagged "someothertag" newest first.

Error on enter serch view.

line   17:                                                                                                                                             
RuntimeError: Vim(return):Passing an unparsed header field to Mail::Field.new is deprecated and will be removed in Mail 2.8.0. Use Mail::Field.parse in
stead.                                                                                                                                                 
Press ENTER or type command to continue

custom key mappings

Hi,

I am giving a try to notmuch-vim as a mail client and so far I like how it is simple and efficient. The various options for customization are nice but I would like to add my own key mappings to folders and search buffers using vim's nmap and this does not seem to work. Specifically, I would like that pressing f in folder or search buffers calls the command for fetching new mail. I have tried adding

autocmd FileType notmuch-folders nmap <buffer> f :!mbsync inbox<cr>

in my vimrc but the mapping is just ignored.

After some exploration of the code, I found that the function set_map in notmuch.vim starts with nmapclear <buffer> so it effectively clears any custom normal-mode mappings when creating a notmuch buffer. Adding my mapping in notmuch_custom_search_maps does not work since the command I want is not a function provided in notmuch.vim.

Is there a proper way to fix this issue?

Does not load..

I've installed notmuch-vim from Ubuntu apt-get and get a "Not an editor command: Notmuch" error. I see that notmuch.vim is loaded in vim. I tried to clone this repo and install, but same result.

Problems with installation on Mac

Apparently the install on MacOS does not accept the -D option (I think is working just for Linux systems).

install -v -D -m644 /Users/cazzimiei/Downloads/notmuch-vim-master/notmuch.vim /Users/cazzimiei/.vim/plugin/notmuch.vim
install: illegal option -- D
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 file2
       install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
               [-o owner] file1 ... fileN directory
       install -d [-v] [-g group] [-m mode] [-o owner] directory ...
make: *** [install] Error 64

Anyway this was easily overcome using Vim Plugged (Plug 'felipec/notmuch-vim').

memory leak

Do you also get a memory leak after running NotMuchR for a while?

vim loads with 600MB resident at first, and then grows to 2GB easily within a few hours of casual use.

16:42 capslock:Documents/co/msp% ps auwx|grep vim
yeled          49529   0.2  0.0  2434892    548 s025  S+    4:47pm   0:00.01 grep vim
yeled          40445   0.0  0.1  2468056   8172 s002  S+   Tue12pm   0:02.04 vim bin/contentsearch.sh
yeled          37783   0.0  0.1  2468572   6984 s016  S+   Tue12pm   0:00.71 vim lib/msp/commands/definitions/ingestion.rb
yeled          35292   0.0  0.1  2468056   8044 s021  S+   Tue10am   0:00.53 vim views/index.erb views/layout.erb
yeled          35224   0.0  0.1  2500548   8768 s009  S+   Tue10am   0:06.58 vim main.rb
yeled          24205   0.0 24.8 22561960 3120560 s014  S+   12:09pm   4:32.09 vim -c :NotMuchR

Error on opening tag

:call <SNR>12_folders_show_search()
Error detected while processing function <SNR>12_folders_show_search[5]..provider#ruby#Call[17]..<SNR>12_folders_show_search:
line    5:
RuntimeError: function <SNR>12_folders_show_search[5]..provider#ruby#Call[17]..<SNR>12_folders_show_search[5]..<SNR>12_search[5]..provider#ruby#Call[17]..<SNR>12_search, line 5: Vim(return):NameError: uninitialized constant Mail::Field

gpg?

Is there a way to sign (and optionally encript) all messages with gpg? I couldn't find how to do something like in the emacs client

Error at initialization

When launching :NotMuch in neovim, I get the following error, and an empty result. notmuch is initialized, notmuch search tag:inbox gives a non-empty result.

Error detected while processing function <SNR>41_NotMuch:                   
line  474:
ArgumentError: wrong array length at 8 (expected 2, was 1)
Error detected while processing function <SNR>41_NotMuch[478]..<SNR>41_folders[1]..<SNR>41_new_buffer:
line    6:
TypeError: no implicit conversion of nil into String
Error detected while processing function <SNR>41_NotMuch[478]..<SNR>41_folders:
line    2:
NoMethodError: undefined method `query' for nil:NilClass

Attachment handling?

Currently notmuch-vim doesn't appear to handle attachments at all. Is there any plan to add attachment saving, at the minimum, or inline attachment viewing for non-binary attachments?

key bindings

This plugin looks very promising, thanks for making it available.

I'm having a little difficulty figuring out the key map. I don't see an entry to compose a new message, although reply does seem to work. In fact I don't see a function anywhere in the plugin to start a new message.

Also when I read mail, it does not get marked as read.

Any help is much appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.