# HG changeset patch # User Meredith Howard # Date 1470829609 14400 # Node ID 91d4fb4e0a428c17d89d6570e7481b6cb484dcf9 # Parent a9ef42db273e37bcd5b346e665eacad715936cc4 improve text editing experience? diff --git a/.vim/ftplugin/asciidoc.vim b/.vim/ftplugin/asciidoc.vim new file mode 100644 --- /dev/null +++ b/.vim/ftplugin/asciidoc.vim @@ -0,0 +1,1 @@ +runtime ftplugin/text.vim diff --git a/.vim/ftplugin/mail.vim b/.vim/ftplugin/mail.vim --- a/.vim/ftplugin/mail.vim +++ b/.vim/ftplugin/mail.vim @@ -9,24 +9,11 @@ function! JumpAndInsert() endif endfunction -function! AutoFmtToggle() - if &formatoptions =~ 'a' - set fo-=a - echo '-a' - else - set fo+=a - echo '+a' - endif -endfunction - augroup mail_filetype autocmd! autocmd BufReadPost mutt-* :call JumpAndInsert() augroup END setl textwidth=72 -setl formatoptions=aw +setl formatoptions+=awt12 setl spell - -map a :call AutoFmtToggle() -imap a :call AutoFmtToggle() diff --git a/.vim/ftplugin/markdown.vim b/.vim/ftplugin/markdown.vim new file mode 100644 --- /dev/null +++ b/.vim/ftplugin/markdown.vim @@ -0,0 +1,1 @@ +runtime ftplugin/text.vim diff --git a/.vim/ftplugin/pod.vim b/.vim/ftplugin/pod.vim new file mode 100644 --- /dev/null +++ b/.vim/ftplugin/pod.vim @@ -0,0 +1,1 @@ +runtime ftplugin/text.vim diff --git a/.vim/ftplugin/text.vim b/.vim/ftplugin/text.vim new file mode 100644 --- /dev/null +++ b/.vim/ftplugin/text.vim @@ -0,0 +1,2 @@ +setl textwidth=80 +setl formatoptions+=awt12 diff --git a/.vimrc b/.vimrc --- a/.vimrc +++ b/.vimrc @@ -173,6 +173,19 @@ nnoremap gt :SignifyTog nmap K :call ViewDoc('doc', '') nmap gK :call ViewDoc('doc', expand('')) nmap gKK :call ViewDoc('doc', expand('%')) + + +function! AutoFmtToggle() + if &formatoptions =~ 'a' + setl fo-=a + echo '-a' + else + setl fo+=a + echo '+a' + endif +endfunction + +map a :call AutoFmtToggle() "}}} @@ -204,6 +217,7 @@ set expandtab set shiftwidth=2 set softtabstop=2 +set formatoptions=cqljn1 set backspace=indent,eol,start " set number @@ -302,14 +316,12 @@ augroup vimrc autocmd FocusLost * silent! wa - " you have to go out of your way to make this stick - autocmd BufNewFile,BufRead * setlocal formatoptions-=ro - - autocmd FileType text setlocal textwidth=78 - " preload templates into new buffers by file extension "autocmd BufNewFile * silent! 0r $MYVIM/templates/%:e.template + " double-click to edit + autocmd FileType vimfiler nmap <2-LeftMouse> (vimfiler_edit_file) + " Set file marks by "category" on switch-away autocmd BufLeave *.css,*,less,*.scss normal! mC autocmd BufLeave *.html,*.ep,*.tt normal! mH @@ -386,8 +398,6 @@ endif ">> vimfiler let g:vimfiler_as_default_explorer = 1 -" double-click to edit -autocmd FileType vimfiler nmap <2-LeftMouse> (vimfiler_edit_file) ">> Airline