Loading ...
Sorry, an error occurred while loading the content.

Re: mutt and vim playing together

Expand Messages
  • Tim Chase
    ... I guess the difference between using :noh and let @/= would be whether your viminfo keeps track of your most recent search, and if so, whether you
    Message 1 of 10 , Dec 29, 2011
    • 0 Attachment
      On 12/29/11 10:38, Dominique Pellé wrote:
      > Tim Chase wrote:
      >> On 12/29/11 08:16, Kai Weber wrote:
      >>> What I want to achieve is jumping to the first blank line
      >>> where I can start typing my mail instantly. So I search
      >>> for ^$ and vim jumps to the first occurrence (with the
      >>> consequences I wrote in my first mail).
      >>
      >>
      >> You could just issue a "noh" after your search:
      >>
      >> vim +'/^$/' -c'set hls' -c'noh'
      >>
      >> should do the trick (I don't have 'hls' set in my vimrc, so
      >> I added it on the command-line to test).
      >
      >
      > If you want to keep the 'hls' option (so further searches
      > while reading or editing your email will still be
      > highlighted), you could set the "/ register to an empty string
      > right after jumping after the first empty line with something
      > like this:
      >
      > vim +'/^$/+1' +'let @/ = ""'

      I guess the difference between using ":noh" and "let @/=''" would
      be whether your viminfo keeps track of your most recent search,
      and if so, whether you want it upon starting to compose your
      email. Using ":noh" just tells it not to highlight the searched
      item, while the ":let" clears the search completely (overriding
      what the viminfo may have held).

      -tim


      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • sc
      On Thursday, December 29, 2011 07:00:59 Kai Weber wrote: Hi, I use vim in combination with mutt. To start vim I have following setting in my muttrc:
      Message 2 of 10 , Dec 29, 2011
      • 0 Attachment
        On Thursday, December 29, 2011 07:00:59 Kai Weber wrote: > Hi, > I use vim in combination with mutt. To start vim I have > following setting in my muttrc: [snip] > Any other recommendations for a good mail editing workflow? when i used mutt i liked having the flexibility of a mail script for vim, so i put set editor="vim -S ~/.vim/mail.vim" in my ~/.muttrc you can get as fancy or as simple as you want in that script here's mine: <mail.vim> " mail mode settings setlocal ft=mail setlocal tw=64 let @n = '> kki' " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if has("gui_running") winpos 324 228 set columns=70 set lines=35 endif " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ nmap <silent> <F1> :call F1_formatter("64")<CR> imap <silent> <F1> <C-O>:call F1_formatter("64")<CR> nmap <S-F1> :call F1_toggle_width("64")<CR> imap <S-F1> <C-O>:call F1_toggle_width("64")<CR> " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ let mapleader = ',' nnoremap <Leader>ee :source ~/.vim/mail.vim<CR> nnoremap <Leader>ev :edit ~/.vim/mail.vim<CR> " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ " clean up quoting silent %s/^> /> /e silent %s/^> $//e " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </mail.vim> now for example while in insert mode i can use ctrl-r n to insert my remarks inside quoted text grrrr -- kmail has bolixed what i have in there for @n it should look like let @n = '^M^M^M^M> ^[kki' where each ^M is an actual return (i should go back to using mutt :) for your purposes you might want to add function! FirstBlankAtEnd() let go = NumberBlankLinesAtEnd() - 1 normal G if (go > 0) execute 'normal ' go . 'k' endif endfunction function! NumberBlankLinesAtEnd() let s:bc = 0 let s:lp = line("$") while s:lp > 0 let s:tl = strlen(getline(s:lp)) if (s:tl > 0) let s:lp = 0 else let s:bc = s:bc + 1 let s:lp = s:lp - 1 endif endwhile return s:bc endfunction and add a call to FirstBlankAtEnd to your editor command in .muttrc something to play around with if you want to get fancy

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Kai Weber
        ... Yes it does! Thanks a lot. Did not know about -c until now. -- You received this message from the vim_use maillist. Do not top-post! Type your reply
        Message 3 of 10 , Dec 29, 2011
        • 0 Attachment
          * Tim Chase <vim@...>:

          > You could just issue a "noh" after your search:
          >
          > vim +'/^$/' -c'set hls' -c'noh'
          >
          > should do the trick (I don't have 'hls' set in my vimrc, so I added
          > it on the command-line to test).

          Yes it does! Thanks a lot. Did not know about "-c" until now.

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Christian Brabandt
          Hi Kai! ... You really should put your settings into ~/.vim/after/ftplugin/mail.vim (you can leave out the after directory, depending on whether you want your
          Message 4 of 10 , Dec 29, 2011
          • 0 Attachment
            Hi Kai!

            On Do, 29 Dez 2011, Kai Weber wrote:

            > * Marc Weber <marco-oweber@...>:
            >
            > > > So everytime I edit a mail the first line and following manually inserted blank
            > > > lines are highlighted.
            > > Why do you need this?
            > > Use syntax commands instead.
            >
            > Syntax highlighting is not what I look for.
            >
            > What I want to achieve is jumping to the first blank line where I can start
            > typing my mail instantly. So I search for ^$ and vim jumps to the first
            > occurrence (with the consequences I wrote in my first mail).
            >
            > But thinking about it... my solution could be to jump at the end of the file.
            > Now I have in my muttrc
            >
            > set editor = "vim +$"
            >
            > Seems to work so far.

            You really should put your settings into ~/.vim/after/ftplugin/mail.vim
            (you can leave out the after directory, depending on whether you want
            your settings to apply before or after sourcing the provided filetype
            scripts which are distributed with vim, e.g.
            /usr/share/vim/vim73/ftplugin/mail.vim) and leave your mutt setting to
            set editor=vim

            For this to work, you need at least an
            :filetype on
            in your .vimrc, so vim will source for each filetype a matching file in
            your runtime path.

            Also since you want Vim to position the cursor on the first empty line
            without having the highlight option apply, you can simply dump into the
            filetype plugin this:

            call cursor(1,1)
            call search('^$')

            See also the faq and the help:
            http://vimhelp.appspot.com/vim_faq.txt.html#faq-26.1
            :h 43.1
            :h ftplugins


            regards,
            Christian

            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • Kai Weber
            ... I went this way. Thank you very much. -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text you are
            Message 5 of 10 , Jan 1, 2012
            • 0 Attachment
              * Christian Brabandt <cblists@...>:

              > You really should put your settings into ~/.vim/after/ftplugin/mail.vim

              I went this way. Thank you very much.

              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            Your message has been successfully submitted and would be delivered to recipients shortly.