LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Vim, textwidth, pine and tin (https://www.linuxquestions.org/questions/linux-software-2/vim-textwidth-pine-and-tin-238254/)

mr666white 10-03-2004 11:52 AM

Vim, textwidth, pine and tin
 
Ok I have some irritating problems with my linux account at uni. Never had these problems at home, so I'm a bit stuck.

vim is my editor of choice
tin is my newsreader of choice
pine is hte mail client imposed

every time I reply to a post i need to do
Code:

:set textwidth=72
There must be someway to do this automagicly for me when i call vim from tin

my .vimrc as it stands
Code:


filetype plugin on
filetype on
syntax on
autocmd FileType mail set textwidth=72


let TextFiles = "*.txt,/tmp/pico.*,.article.*,.followup.*,.letter.*"
execute "autocmd BufEnter " . TextFiles . " set textwidth=72"
execute "autocmd BufLeave " . TextFiles . " set textwidth=0"
unlet TextFiles

map <C-Z> :echo "Suspending `Vim' has been disabled; see .vimrc for details."<CR>
" The above line disables the normal function of <Ctrl>+Z and displays a
" message instead.  <Ctrl>+Z in generally Unix suspends jobs.  This is a useful
" feature, but can be confusing for beginners, especially if <Ctrl>+Z is
" pressed by mistake (perhaps when aiming for capital Z), so it's been
" disabled.  To enable it, simply remove the above map line from this file.
autocmd VimEnter .article if line('.') == line('$') | yank | put
autocmd VimEnter .followup if line('.') != 1 | normal gq${j

set t_kb=^?
fixdel
set tabstop=4
set background=dark

Ideally, vim should wrap text, mail and comments to 72 chars, but leave my code alone

Also, how the hell do i get pine to accept vim as my editor of choice. I hate pico with a passion

jschiwal 10-03-2004 12:07 PM

Here is a web page called 'pine & vim': http//www.stripey.com/vim/pine.html

The following is excepted from that web-site:


[code]
Calling Vim from Pine
By default Pine uses its own built-in editor, Pico. To have it use Vim instead requires this setting:
Code:

editor                  = vim
That much is fairly obvious. Rather less so is that these two settings are needed as well:
Code:

            [X]  enable-alternate-editor-cmd         
            [X]  enable-alternate-editor-implicitly

These settings can be found by pressing S then C at the main menu, then using the W command to search for the string editor.
Once set up headers will be edited in Pine exactly as before, but moving ‘down’ past the last header and into the message body will cause Vim to be launched to edit the body; no headers will be loaded into Vim.

Plain Text (Human Language) Files
Different formatting settings are designed for plain text files, those just containing ordinary English (or whatever) language. There isn’t a default filetype for these, so define that all files with the extension .txt should be assumed to be ‘human’ format. Mail and news articles also fall into this category; they already have a filetype, though I also want anything in my postponed directory to be considered a news article, so I have:
Code:

augroup filetype
  autocmd BufNewFile,BufRead */.Postponed/* set filetype=mail
  autocmd BufNewFile,BufRead *.txt set filetype=human
augroup END

(This clobbers the help filetype, but this doesn’t seem to prevent help from working properly.)
Then Vim can be set up so that line breaks are automatically inserted in all human text. I have these at 72 characters so that even if my mail or news article is quoted by somebody else, it still fits into an 80-column terminal:
Code:

autocmd FileType mail,human set formatoptions+=t textwidth=72


All times are GMT -5. The time now is 05:03 AM.