Skip to content

Commit c68ecbe

Browse files
authored
removing custom formatting (pangloss#565)
also adds `nolisp` setting
1 parent 1785664 commit c68ecbe

1 file changed

Lines changed: 1 addition & 62 deletions

File tree

indent/javascript.vim

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let b:did_indent = 1
1010

1111
" Now, set up our indentation expression and keys that trigger it.
1212
setlocal indentexpr=GetJavascriptIndent()
13-
setlocal formatexpr=Fixedgq(v:lnum,v:count)
13+
setlocal nolisp
1414
setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e
1515
setlocal cinoptions+=j1,J1,c1
1616

@@ -209,66 +209,5 @@ endfunction
209209

210210
let &cpo = s:cpo_save
211211
unlet s:cpo_save
212-
" gq{{{2
213-
function! Fixedgq(lnum, count)
214-
let l:tw = &tw ? &tw : 80;
215212

216-
let l:count = a:count
217-
let l:first_char = indent(a:lnum) + 1
218-
219-
if mode() == 'i' " gq was not pressed, but tw was set
220-
return 1
221-
endif
222-
223-
" This gq is only meant to do code with strings, not comments
224-
if s:IsInComment(a:lnum, l:first_char)
225-
return 1
226-
endif
227-
228-
if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq
229-
return 1
230-
endif
231-
232-
" Put all the lines on one line and do normal spliting after that
233-
if l:count > 1
234-
while l:count > 1
235-
let l:count -= 1
236-
normal J
237-
endwhile
238-
endif
239-
240-
let l:winview = winsaveview()
241-
242-
call cursor(a:lnum, l:tw + 1)
243-
let orig_breakpoint = searchpairpos(' ', '', '\.', 'bcW', '', a:lnum)
244-
call cursor(a:lnum, l:tw + 1)
245-
let breakpoint = searchpairpos(' ', '', '\.', 'bcW', s:skip_expr, a:lnum)
246-
247-
" No need for special treatment, normal gq handles edgecases better
248-
if breakpoint[1] == orig_breakpoint[1]
249-
call winrestview(l:winview)
250-
return 1
251-
endif
252-
253-
" Try breaking after string
254-
if breakpoint[1] <= indent(a:lnum)
255-
call cursor(a:lnum, l:tw + 1)
256-
let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_expr, a:lnum)
257-
endif
258-
259-
260-
if breakpoint[1] != 0
261-
call feedkeys("r\<CR>")
262-
else
263-
let l:count = l:count - 1
264-
endif
265-
266-
" run gq on new lines
267-
if l:count == 1
268-
call feedkeys("gqq")
269-
endif
270-
271-
return 0
272-
endfunction
273-
"}}}
274213
" vim: foldmethod=marker:foldlevel=1

0 commit comments

Comments
 (0)