[ Back | warped.org ]

HOWTO - Mutt using VIM with accented characters

How to use Mutt as your mailer and VIM as your editor and have them play nice with accented charcters.

  1. Mutt

    • .muttrc:

      # This next line for those people who send you high characters but
      # claim that they're using ascii
      charset-hook us-ascii iso-8859-1
      set send_charset="us-ascii:iso-8859-1"

    • .bashrc : See Also this thing on locales.

      export LANG=
      export LC_CTYPE=en_US

      Note that setting LANG to en_US set the charset for VIM and for the index view of mutt, but the pager still showed me \123 instead of the right character.

    • VIM - Turn on Dead Keys

      Thanks to Claudio Fliener for the code that started this one.

      Note:You should see accented characters below in the 2nd column, or you have a problem with your browser. Save the source of this file and work from that, don't just copy and paste from the browser.

      • .vimrc:

        nm <F6> :call DeadKeys()<CR>
        nm <F7> :call DeadKeysOff()<CR>
        function! DeadKeys()
            :echo "Dead Keys: On"
            let g:DeadKeysOn=1
            " map dead keys
            :imap "a    
            :imap "A    
            :imap "e    
            :imap "E    
            :imap "i    
            :imap "I    
            :imap "o    
            :imap "O    
            :imap "u    
            :imap "U    
            :imap "y    
            :imap "<space>    ""<bs>
            :imap ""    ""<bs>
        
            :imap 'a    
            :imap 'A    
            :imap 'e    
            :imap 'E    
            :imap 'i    
            :imap 'I    
            :imap 'o    
            :imap 'O    
            :imap 'u    
            :imap 'U    
            :imap 'y    
            :imap ''    ''<bs>
            :imap '<space>    ''<bs>
        
            :imap 'c    
            :imap 'C    
        
            :imap `a    
            :imap `A    
            :imap `e    
            :imap `E    
            :imap `i    
            :imap `I    
            :imap `o    
            :imap `O    
            :imap `u    
            :imap `U    
            :imap ``    ``<bs>
            :imap `<space>    ``<bs>
        
            :imap ^a    
            :imap ^A    
            :imap ^e    
            :imap ^E    
            :imap ^i    
            :imap ^I    
            :imap ^o    
            :imap ^O    
            :imap ^u    
            :imap ^U    
            :imap ^y    xxxx
            :iunmap ^y
            :imap ^^    ^^<bs>
            :imap ^<space>    ^^<bs>
        
            :imap ~n    
            :imap ~N    
            :imap ~~    ~~<bs>
            :imap ~<space>    ~~<bs>
        endfunction " deadkeys()
        
        function! DeadKeysOff()
            " Make sure turning them off without having turned them on 
            " does nothing bad.
            if !exists("g:DeadKeysOn") || !g:DeadKeysOn
                :echo "Dead Keys not on."
                return
            endif
        
            :echo "Dead Keys: Off"
            let g:DeadKeysOn=0
            :iunmap "a
            :iunmap "A
            :iunmap "e
            :iunmap "E
            :iunmap "i
            :iunmap "I
            :iunmap "o
            :iunmap "O
            :iunmap "u
            :iunmap "U
            :iunmap "y
            :iunmap ""
            :iunmap "<space>
        
            :iunmap 'a
            :iunmap 'A
            :iunmap 'e
            :iunmap 'E
            :iunmap 'i
            :iunmap 'I
            :iunmap 'o
            :iunmap 'O
            :iunmap 'u
            :iunmap 'U
            :iunmap 'y
            :iunmap '<space>
            :iunmap ''
        
            :iunmap 'c
            :iunmap 'C
        
            :iunmap `a
            :iunmap `A
            :iunmap `e
            :iunmap `E
            :iunmap `i
            :iunmap `I
            :iunmap `o
            :iunmap `O
            :iunmap `u
            :iunmap `U
            :iunmap `<space>
            :iunmap ``
        
            :iunmap ^a
            :iunmap ^A
            :iunmap ^e
            :iunmap ^E
            :iunmap ^i
            :iunmap ^I
            :iunmap ^o
            :iunmap ^O
            :iunmap ^u
            :iunmap ^U
            ":iunmap ^y
            :iunmap ^^
            :iunmap ^<space>
        
            :iunmap ~n
            :iunmap ~N
            :iunmap ~~
            :iunmap ~<space>
        
        endfunction
            

If this information helped you, consider exiting through your right. ©2000-2013 Max Baker
Sun Apr 27 22:32:33 2008 PST