Saturday, March 21, 2015

Re: What sets textwidth=78

On Wednesday, March 18, 2015 at 12:18:46 PM UTC-7, Ben Fritz wrote:
> On Wednesday, March 18, 2015 at 1:28:49 PM UTC-5, porphyry5 wrote:
> > On Monday, March 16, 2015 at 11:12:10 AM UTC-7, nekneknek...@gmail.com wrote:
> > > :verbose set textwidth
> > >
> > > itchyny
> >
> > I thank you for your help, but all this shows me is the current setting of textwidth.
>
> Wrong.
>
> This shows the current setting, *AND WHAT SCRIPT MADE THAT SETTING HAPPEN*.

NOT ONE OF MINE. I have absolutely no interest in a limited textwidth under any circumstances.

>
> The next time you see a textwidth setting you don't want, run this command to see where it was set to that value.

Which command?

>
> Then it is easy to zap the bad setting. It would be much harder to prevent or overwrite the setting without knowing what is setting it in the first place.
>
> My guess is you have a filetype plugin or autocmd firing. But I obviously have no way of knowing which one that might be on YOUR system.

Here is the entirety of my .vimrc. All the set and autocommands are in a group at the end of it.
map __ :xa<CR>
" Directory and file access
map _D :e /mnt/1/Documents<CR>
map _E :e /mnt/1/Documents/Essays<CR>
map _H :e /home/g<CR>
map _J :e /mnt/1/Scripts/junk.sh<CR>
map _L :e /mnt/1/MyBooks/Programming/Linux<CR>
map _P :e /mnt/1/MyBooks/Pdfs<CR>
map _R :e /mnt/1/Redo<CR>
map _S :e /mnt/1/Scripts/<CR>
map _T :e /mnt/1/Scripts/test.sh<CR>
map _V :e ~/.vim/<CR>
" Convert .ass to .srt. Put cursor on start of line before 1st dialog line
map _as :normal dgg<CR>:%s/^[^,]*,/\r/<CR>:%s/,/ --> /<CR>:%s/,.*,,.*,,/\r/<CR>:%s/\\N/\r/g<CR>
map _b :buffers<CR>
" ConcatenateTitles and accumulate them in register z
map _c :call CapCon()<CR>:s/^\([0-9]*\)\(.*\)/\2\1/<CR>:normal "Zyy<Space>j<CR>
map _d /[A-Za-z]<CR>:normal d$mm<CR>:let @/=@"<CR>:normal n<CR>:call CapCon()<CR>:normal 0y$`mpj0<CR>
" Convert footnotes, {\d\+}, to html form
map _fn gg/{\d\+}<CR>"pyWx"qdwx:let @r='<a name="fn' . @q . '"></a><a href="#FN' . @q . '">' . @q . '</a>'<CR>"rP:let @/=@p<CR>//<CR>dW:let @r='<a name="FN' . @q . '"></a><a href="#fn' . @q . '">' . @q . '</a>'<CR>"rP;fn
" Fix common errors in ebook texts
map _ft :%s/ \([,.?!;:]\)/\1/g<CR>:%s/^\s\+\("[^"]\+\)\n\s*\([^"]\+"\)/\1 \2/c<CR>:%s/" "/"\r\t"/<CR>:%s/^\(["A-Z]\)/\t\1/<CR>:%s/^\s\+/\t/<CR>:%s/\. "/.\r\t"/g<CR>
" Convert invalid character codes
map _g :%s/\nâ\%x80\%xa0/ ++\r/ge<CR>:%s/â\%x80\%xa0/ ++/ge<CR>:%s/â\%x80¢/\*/ge<CR>:%s/Ë\%x86/\^/ge<CR>:%s/â\%x80\%x93/-/ge<CR>:%s/ï¬\%x82/fl/ge<CR>:%s/ï¬\%x81/fi/ge<CR>:%s/Ë\%x9c/\~/ge<CR>:%s/\%x80\%x99/'/ge<CR>:%s/\%x80\%x9c/"/ge<CR>:%s/\%x80\%x9d/"/ge<CR>:%s/\%x80"/ - /ge<CR>:%s/\%x80\%x98/'/ge<CR>:%s/\%x80\%x94/ -- /ge<CR>:%s/\%x80\%x93/-/ge<CR>:%s/â\%x86\%x90//ge<CR>:%s/â\%x86\%x92//ge<CR>:%s/â//ge<CR>:%s/\%x88\%x92/-/ge<CR>:%s/\%x88\%x9e\$\%x8a\%x88\%x9e//ge<CR>:%s/\([a-z]\)\- \([a-zA-Z]\)/\1\2/ge<CR>:%s/\- *\n *\([a-zA-Z]\)/\1/ge<CR>
map _G :%s/^$\n//ge<CR>:%s/([^)]*)//ge<CR>:%s/\[[^]]*\]//ge<CR>:%s/{[^}]*}//ge<CR>:%s/ [a-zA-Z0-9]\./ /ge<CR>:%s/^[a-zA-Z0-9]\. //ge<CR>:%s/ &[^;]*; / /ge<CR>:%s/[0-9]\+//ge<CR>:%s/(.*\n[^)]*)//e<CR>:%s/{.*\n[^}]*}//e<CR>:%s/\[.*\n[^]]*\]//e<CR>:%s/\s\+/\r/ge<CR>:%s/[Aa][Ee]lig/ae/ge<CR>:%s/[!?:"(){}\[\]\|<>\/;,.@#$%^&*_+=\-`\~\\]//ge<CR>:%s/^'//e<CR>:%s/'$//e<CR>:%s/[A-Z]/\l&/ge<CR>:sort u<CR>
" ;ht Converts essays to html. Does title, double spaces, <P> and </body></html. Do ;n on wf.txt first.
map _ht :%s/^$/<P>/e<CR>:%s/ / \&nbsp;/ge<CR>ggO<ESC>:let a = substitute(@%, "[^A-Za-z].*", "", "")<CR>:let b = substitute(a, '\([a-z]\)\([A-Z]\)', '\1 \2', "g")<CR>:let @m = '<h2 align="CENTER"><a name="' . b . '">' . b . '</a></h2>'<CR>"mPGo</body></html><ESC><CR>ggO<ESC><CR>:r wf.txt<CR>kdd<CR>
" ;hn Make heading and anchor, accumulate links in z. ;hn
map _hn /^Chapter <CR>wd0y$i<h3><a name="chapter<Esc>A">Chapter <Esc>pA</a></h3><Esc>j:let @Z=@z . '<a href="#chapter' . @" . '">Chapter ' . @" . '</a><br>'<CR>
map _hn :source ~/.vim/hn.vim<CR>
" Do chapter headings from each Chapter line and accumulate hrefs in register z
map _h3 /\tChapter \d\+<CR>xd2w:let @m='<h3><a name="' . @" . '">' . @" . '</a></h3>'<CR>"mPj:let @Z='<a href="#' . @" . '">' . @" . '</a><br>@'<CR>;h3
" Do chapter headings line by line from a Contents
map _h1 0EBy$:let @/=@"<CR>:let @q=@" . '">' . @" . '</a><'<CR>0c$<a href="#<Esc>"qpAbr><Esc>jmm//<CR>0c$<h3><a name="<Esc>"qpA/h3><Esc>'m
" Do Chapter headings line by line found in text by a search pattern
map _h2 0i<h3><a name='<Esc>ly$A'><Esc>pa<\/a><\/h3><Esc>:let @Z='<a href="#' . @" . '">' . @" . '<\/a>'<CR>
map _m :marks<CR>
" ;n Converts keywords in wf.txt to <META keywords and description ready to type. Run wf() first.
map _n :%s/^[0-9 ]\+//ge<CR>gg"myGgUG"ndG"mP:.,$s/\<[a-z]/\u&/ge<CR>"mP"nP:%s/\(.*\)\n/\1,/ge<CR>$xxa"></head><body><ESC>0i<META NAME="keywords" CONTENT="<ESC>O<html><head><META NAME="description" CONTENT="
" Remove empty lines and link numbers from most recent paste
map _p :'[,']s/\n\n/\r/<CR>:'[,']s/\[\d\+\]//g<CR>
" Fix page numbers and TOC in pdftotext output. MUST set marks a, b first
map _pt :'a,'bd<CR>:'c,'ds/[^A-Za-z0-9][^A-Za-z0-9][^A-Za-z0-9]\+/ /ge<CR>:'c,'ds/^ .*$\n//ge<CR>:'e,'fs/^ .*$\n//ge
":%s/†/"/ge<CR>:%s/“/"/ge<CR>
map _pu :'b,'cs/^\([0-9][0-9]\?\)\n\n\n\n\?\([A-Z].*\)/Chapter \1 \2/ce<CR>
map _pv :'b,'cs/^\%x0c\(Appendix [A-Z]\)\n\n\n\([A-Z].*\)/\r\1 \2/ce<CR>
" Close help window and restore textwidth to no limit
map _q :q<CR>:set textwidth=0<CR>
" Show contents of registers
map _r :reg<CR>
" Show cursor location in red, see also hi commands at end of this file
map _s :set cuc<CR>:set cul<CR>:sleep<CR>:set cuc!<CR>:set cul!<CR>
" standardize text before converting to epub, do chpter headings first
map _t :%s/^\s\+/\t/e<CR>:%s/" "/"\r\t"/ge<CR>:%s/' '/'\r\t'/ge<CR>:%s/\n\t\([a-z\-]\)/ \1/e<CR>:%s/\s\+$//e<CR>:%s/\([^.?!"']["']*\)\n\t\([^"']\)/\1 \2/ce<CR>
" Set up latest command to be appended to .vimrc
map _v 'VGo" <Return>" <Esc>":PkA
" Write current file and copy it to /mnt/1
map _w :w<CR>:exe "!cp % /mnt/1/%"<CR><CR>
" Paste sorted contents of register z above current line
map _zp :let @z = join(sort u(split(@z, "\n")), " ") . "\n"<CR>"zP<CR>:let @z = ""<CR>
" If number find next occurrence alone on its own line, if file path display it
map \\ :normal WB"myW<CR>:let c = stridx(@m, '.')<CR>:if c < 0<CR>:let a = '^' . substitute(@m, '^\s*\(.\{-}\)\s*$', '\1', '') . '$'<CR>:let l = search(a, 'esw')<CR>:normal zt<CR>:else<CR>:let @m = @m . " &"<CR>:exec "!xv" @m<CR>:endif<CR><CR>
" Arrow key mappings
map <A-right> <ESC>:bn<CR>
map <A-left> <ESC>:bp<CR>
map <DOWN> gj
map <UP> gk
imap <UP> <ESC>gki
imap <DOWN> <ESC>gji
" Look up help for current word/WORD
map <F1> <ESC>:exec "help ".expand("<cWORD>")<CR>
" Toggle line numbers
map <F2> :set nonumber!<CR>
" <F3> Toggle automatic indent for "pastes" <F3>
" Toggle text colorization
map <silent> <F4> :if exists("g:syntax_on")<CR>syntax off<CR>else<CR>syntax enable<CR>endif <CR>
"
" Ebook Error Correction Group
" search text for next error, if not found delete from y.sed and find next
map _9 :let v:errmsg = ""<CR>:silent! / z<CR>zz `m:if v:errmsg != ""<CR>:exe "norm dd<F6>"<CR>:endif<CR><CR>
" resume editing if vim shows y.sed
map <F5> 0ll"zyt/f/lmm'WG$"yp:.,$s/\\>.*//e<CR>'[:.,$s/^....//e<CR>'[dd:.,$s/^[A-Z].*\n//e<CR>:%s/^\s*$\n//e<CR> 'mqyq:split y<CR>_9:%s/.*[A-Z][a-z].*\n//c<CR>
" do not add to wd.s, do current line
map <F6> 0ll"zyt/f/lmm _9
" add to wd.s, do current line
map <F7> :let @Y=@"<CR><F6>
" fix concatenations, put cursor on first letter of concatenated word in y.sed line
map <F8> mm"qyF\`m"pyw:s/ p/\\(\[a\-z\]\\+\\)/e<CR>:s// \\1/e<CR>j:.,$s/.* q.*\n//e<CR>'m j
" whitespace from line ends, join lines if no sentence end, speech ending as ' -$' to ..."
map <F9> gg:%s/\([.?!] \)\([a-z]\)/\1\u\2/eg<CR>:%s/ \+$//e<CR>:%s/\("[^"]*\) \-$/\1..."/e<CR>:%s/\n\t\([a-z]\)/ \1/cge<CR>
" correct error by replacing '-' with ' - '
map <F10> $F-xi - <Esc>j<F6>
" Capitalize any sentence beginning with lower case letter
map _1 :%s/\([.?!]\) *\([a-z]\)/\1 \u\2/g<CR>
" Chapterize txt to html and chapterize lines that start with one or more upper case letters
map _2 :%s/\t/<p>/e<CR>:%s/^\([A-Z]\+\.* .*\)$/<h3>Chapter \1<\/h3>/ce<CR>
" End of ebook correction group
"
" Restore file marks in .viminfo
map _6 :e ~/.viminfo<CR>/^# File marks:<CR>:r /mnt/1/file.mks<CR>']j
map _8 :let @x=@x+1<CR>/<br><b>\d\+<\/b><CR>:s/\(<b>\d\+<\/b>\)/<a name='n x'>\1<\/a>\r<a href='#n x'>\1<\/a>\r/<CR>_8
" Remove search highlights
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
" :Mn Join n lines and reformat as 'textwidth' character lines
com! -nargs=+ M call Join(<f-args>)
function! Join(a)
:s/^\s*/#/
:exe ':normal 0mm ' . a:a . 'JA <'
:normal xmn
:'m,'ns/\([a-z0-9]\)\- \([a-z0-9]\)/\1\2/ge
:'m,'ms/^#/ /
:'m,'ns/^# //e
:normal 'n$xjzz
endfunction
com! -nargs=1 H call Hn(<f-args>)
function! Hn(size)
exe ':s/\(.*\)/<H' . a:size . '><a name="\1">\1<\/a><\/H' . a:size . '>\r<a href="#\1">\1<\/a> \&nbsp;/'
endfunction
" :In Invert n lines to columns
com! -nargs=1 I call It(<f-args>)
"com! -nargs=+ I call It(<f-args>)
"function! It(l,c)
function! It(n)
let l=0
let a=[]
while l<n
let a[l] = '["' . substitute(strpart(getline('.'), 4), ' ', '","', 'g') . '"]'
normal dd
let l=l+1
endwh
let n=len(a[1])
let l=0
while l<n
b=

endfunction
" :Tn Strip unessential words the, a, an, is, are in each of n lines
com! -nargs=1 T call Tr(<f-args>)
function! Tr(l)
let n = a:l
while n > 0
s/\<[Tt]he //ge
s/\<[Aa]n\? //ge
s/\<is //ge
s/\<are //ge
s/[,.;:!?]$//ge
let n = n - 1
normal j0
endw
endfunction
function! Params()
let pars = input("Type your parameters, Tab separated, no quotes")
return(split(pars, "\t"))
endfunction
function! CapCon()
normal guu
exe ':s/\-/ /ge'
exe ':s/[^a-z ]//ge'
exe ':s/\<[a-z]/\u&/ge'
exe ':s/ //ge'
endfunction
function! Psrch()
set nopaste
return @/
endfunction
function! GetInp()
call inputsave()
let g:Inp = input("enter search pattern: ")
call inputrestore()
endfunction
function! DoAts()
while 0==0
norm "myWhma
let @n=substitute(@m, "[^a-zA-Z0-9'\-]", "", "g")
let @/='@@' . @n
%s//\=@n/ge
norm `a
redraw
let @/=@n
call GetInp()
if Inp == 'q'
let @o='qq' . @n
%s//\=@o/ge
else
let @Z=@n . ' '
en
norm `an
endw
endfunction
au! BufWritePost ~/.vimrc source % " reload .vimrc whenever updated
set nocompatible " vim default options
set autochdir " pwd is always directory of current buffer
set autoindent " auto indentation turned on as default
set autowriteall " automatically save file when switching buffers
set background=dark
set cmdheight=2 " Set the command window height to 2 lines, for overflow
set cwh=2
set confirm " prevent command failure due to unsaved changes to the file
set cpoptions+=> " Any addition to a register always terminated by one <CR>
set directory=.
filetype plugin indent on
set laststatus=2 " Always display the status line
set linebreak
set mouse=a " allow middle mouse pasting with Shift key held down, like MC
set notimeout ttimeout ttimeoutlen=200 "time out keycodes never mappings
set nrformats=alpha,octal,hex " enable ^A ^X on letters, digits, octal, hex
set pastetoggle=<F3>
set shiftwidth=2 " indent 2 character widths
set showcmd
set statusline=%F%M%R%H%W\ %{&ff}\ %Y\ hex=\%02.2B\ l=%04l,c=%04v,%p%%\ %L
set tabstop=2 " tab is 2 character widths
set viminfo='50,f1,<500,:50,@20,/20,!,%
set visualbell " xterm flashes text color on beep condition
set wildmenu " Better command-line completion
syntax on " Enable syntax highlighting
set hlsearch
set incsearch
set textwidth=0
hi CursorLine ctermbg=1
hi CursorColumn ctermbg=1



--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: