improve text editing experience?

Wed, 10 Aug 2016 07:46:49 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 10 Aug 2016 07:46:49 -0400
changeset 368
91d4fb4e0a42
parent 367
a9ef42db273e
child 369
9b89f81c644b

improve text editing experience?

.vim/ftplugin/asciidoc.vim file | annotate | diff | comparison | revisions
.vim/ftplugin/mail.vim file | annotate | diff | comparison | revisions
.vim/ftplugin/markdown.vim file | annotate | diff | comparison | revisions
.vim/ftplugin/pod.vim file | annotate | diff | comparison | revisions
.vim/ftplugin/text.vim file | annotate | diff | comparison | revisions
.vimrc file | annotate | diff | comparison | revisions
new file mode 100644
--- /dev/null
+++ b/.vim/ftplugin/asciidoc.vim
@@ -0,0 +1,1 @@
+runtime ftplugin/text.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 <silent> <leader>a :call AutoFmtToggle()<CR>
-imap <silent> <leader>a :call AutoFmtToggle()<CR>
new file mode 100644
--- /dev/null
+++ b/.vim/ftplugin/markdown.vim
@@ -0,0 +1,1 @@
+runtime ftplugin/text.vim
new file mode 100644
--- /dev/null
+++ b/.vim/ftplugin/pod.vim
@@ -0,0 +1,1 @@
+runtime ftplugin/text.vim
new file mode 100644
--- /dev/null
+++ b/.vim/ftplugin/text.vim
@@ -0,0 +1,2 @@
+setl textwidth=80
+setl formatoptions+=awt12
--- a/.vimrc
+++ b/.vimrc
@@ -173,6 +173,19 @@ nnoremap <silent> <leader>gt :SignifyTog
 nmap K   :call ViewDoc('doc', '<cword>')<CR>
 nmap gK  :call ViewDoc('doc', expand('<cword>'))<CR>
 nmap gKK :call ViewDoc('doc', expand('%'))<CR>
+
+
+function! AutoFmtToggle()
+  if &formatoptions =~ 'a'
+    setl fo-=a
+    echo '-a'
+  else
+    setl fo+=a
+    echo '+a'
+  endif
+endfunction
+
+map <silent> <leader>a :call AutoFmtToggle()<CR>
 "}}}
 
 
@@ -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 <buffer> <2-LeftMouse> <Plug>(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 <buffer> <2-LeftMouse> <Plug>(vimfiler_edit_file)
 
 
 ">> Airline

mercurial