lib/vmail.vim in vmail-0.0.4 vs lib/vmail.vim in vmail-0.0.5

- old
+ new

@@ -95,24 +95,39 @@ normal jk setlocal nomodifiable redraw endfunction +" from message window function! s:show_next_message() call s:focus_list_window() execute "normal j" execute "normal \<cr>" endfunction function! s:show_previous_message() call s:focus_list_window() - execute "normal k" - if line('.') != 1 - execute "normal \<cr>" - endif + execute "normal k" + if line('.') != 1 + execute "normal \<cr>" + endif endfunction +" from message list window +function! s:show_next_message_in_list() + if line('.') != line('$') + call feedkeys("j\<cr>\<cr>") + endif +endfunction + +function! s:show_previous_message_in_list() + if line('.') != 1 + call feedkeys("k\<cr>\<cr>") + endif +endfunction + + " invoked from withint message window function! s:show_raw() let command = s:show_message_command . s:current_uid . ' raw' echo command setlocal modifiable @@ -167,15 +182,15 @@ setlocal nomodifiable let num = len(split(res, '\n', '')) redraw call cursor(line + 1, 0) normal z. - echom "you have " . num . " new message" . (num == 1 ? '' : 's') . "!" - redrawstatus + redraw + echo "you have " . num . " new message" . (num == 1 ? '' : 's') . "!" else - echom "no new messages" - redrawstatus + redraw + echo "no new messages" endif endfunction function! s:toggle_star() range let lnum = a:firstline @@ -508,11 +523,11 @@ call s:focus_list_window() wincmd p close! endfunction -function! s:deliver_message() +function! s:send_message() write let mail = join(getline(1,'$'), "\n") exec ":!" . s:deliver_command . " < ComposeMessage" redraw call s:focus_list_window() @@ -544,12 +559,12 @@ if !exists("s:savedir") let s:savedir = getcwd() . "/attachments" end let s:savedir = input("save attachments to directory: ", s:savedir) let command = s:save_attachments_command . s:savedir - echo command let res = system(command) + echo res endfunc " -------------------------------------------------------------------------------- func! s:toggle_fullscreen() if winnr('$') > 1 @@ -606,18 +621,19 @@ noremap <silent> <buffer> <Leader>m :call <SID>mailbox_window()<CR> noremap <silent> <buffer> <Leader>v :call <SID>move_to_mailbox()<CR> noremap <silent> <buffer> <Leader>c :call <SID>compose_message()<CR> noremap <silent> <buffer> <Leader>r :call <SID>show_message()<cr>:call <SID>compose_reply(0)<CR> noremap <silent> <buffer> <Leader>a :call <SID>show_message()<cr>:call <SID>compose_reply(1)<CR> - " go fullscreen + noremap <silent> <buffer> <c-j> :call <SID>show_next_message_in_list()<cr> + noremap <silent> <buffer> <c-k> :call <SID>show_previous_message_in_list()<cr> nnoremap <silent> <buffer> <Space> :call <SID>toggle_fullscreen()<cr> endfunc func! s:compose_window_mappings() - " NOTE deliver_message is a global mapping, so user can load a saved + " NOTE send_message is a global mapping, so user can load a saved " message from a file and send it - nnoremap <silent> <Leader>vd :call <SID>deliver_message()<CR> - nnoremap <silent> <buffer> <Leader>vs :call <SID>save_draft()<CR> + nnoremap <silent> <Leader>vs :call <SID>send_message()<CR> + nnoremap <silent> <buffer> <Leader>vd :call <SID>save_draft()<CR> noremap <silent> <buffer> <leader>q :call <SID>cancel_compose()<cr> nmap <silent> <buffer> q <leader>q endfunc call s:create_list_window()