diff --git a/plugin/paredit.vim b/plugin/paredit.vim index 4fcfd9b..2c15bf4 100644 --- a/plugin/paredit.vim +++ b/plugin/paredit.vim @@ -82,7 +82,7 @@ function! PareditInitBuffer() let b:paredit_init = 1 " in case they are accidentally removed " Also define regular expressions to identify special characters used by paredit - if &ft =~ '.*\(clojure\|scheme\|racket\).*' + if &ft =~ '.*\(clojure\|scheme\|racket\|hy\).*' let b:any_matched_char = '(\|)\|\[\|\]\|{\|}\|\"' let b:any_matched_pair = '()\|\[\]\|{}\|\"\"' let b:any_opening_char = '(\|\[\|{' @@ -107,7 +107,7 @@ function! PareditInitBuffer() inoremap " PareditInsertQuotes() inoremap PareditBackspace(0) inoremap PareditDel() - if &ft =~ '.*\(clojure\|scheme\|racket\).*' && g:paredit_smartjump + if &ft =~ '.*\(clojure\|scheme\|racket\|hy\).*' && g:paredit_smartjump nnoremap ( :call PareditSmartJumpOpening(0) nnoremap ) :call PareditSmartJumpClosing(0) vnoremap ( :call PareditSmartJumpOpening(1) @@ -150,7 +150,7 @@ function! PareditInitBuffer() execute 'nmap ' . g:paredit_leader.' d[(,S' execute 'nmap ' . g:paredit_leader.' d])%,S' call RepeatableNNoRemap(g:paredit_leader . 'I', ':call PareditRaise()') - if &ft =~ '.*\(clojure\|scheme\|racket\).*' + if &ft =~ '.*\(clojure\|scheme\|racket\|hy\).*' inoremap [ PareditInsertOpening('[',']') inoremap ] =(pumvisible() ? "\C-Y>" : ""):let save_ve=&ve:set ve=all:call PareditInsertClosing('[',']'):let &ve=save_ve inoremap { PareditInsertOpening('{','}') @@ -219,7 +219,7 @@ function! PareditInitBuffer() silent! unmap cb silent! unmap ciw silent! unmap caw - if &ft =~ '.*\(clojure\|scheme\|racket\).*' + if &ft =~ '.*\(clojure\|scheme\|racket\|hy\).*' silent! iunmap [ silent! iunmap ] silent! iunmap { @@ -251,7 +251,7 @@ endfunction " Include all prefix and special characters in 'iskeyword' function! s:SetKeyword() let old_value = &iskeyword - if &ft =~ '.*\(clojure\|scheme\|racket\).*' + if &ft =~ '.*\(clojure\|scheme\|racket\|hy\).*' setlocal iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94,~,#,\|,& else setlocal iskeyword+=+,-,*,/,%,<,=,>,:,$,?,!,@-@,94,~,#,\|,&,.,{,},[,] @@ -574,7 +574,7 @@ function! s:IsBalanced() return 0 endif - if &ft =~ '.*\(clojure\|scheme\|racket\).*' + if &ft =~ '.*\(clojure\|scheme\|racket\|hy\).*' let b1 = searchpair( '\[', '', '\]', 'brnmW', s:skip_sc, matchb ) let b2 = searchpair( '\[', '', '\]', 'rnmW', s:skip_sc, matchf ) if !(b1 == b2) && !(b1 == b2 - 1 && line[c-1] == '[') && !(b1 == b2 + 1 && line[c-1] == ']') @@ -637,7 +637,7 @@ function! s:Unbalanced( matched ) while 1 let matched = tmp let tmp = substitute( tmp, '(\(\s*\))', ' \1 ', 'g') - if &ft =~ '.*\(clojure\|scheme\|racket\).*' + if &ft =~ '.*\(clojure\|scheme\|racket\|hy\).*' let tmp = substitute( tmp, '\[\(\s*\)\]', ' \1 ', 'g') let tmp = substitute( tmp, '{\(\s*\)}', ' \1 ', 'g') endif @@ -645,7 +645,7 @@ function! s:Unbalanced( matched ) if tmp == matched " All paired chars eliminated let tmp = substitute( tmp, ')\(\s*\)(', ' \1 ', 'g') - if &ft =~ '.*\(clojure\|scheme\|racket\).*' + if &ft =~ '.*\(clojure\|scheme\|racket\|hy\).*' let tmp = substitute( tmp, '\]\(\s*\)\[', ' \1 ', 'g') let tmp = substitute( tmp, '}\(\s*\){', ' \1 ', 'g') endif @@ -810,7 +810,7 @@ function! s:ReGatherUp() normal! ddk endwhile normal! Jl - elseif g:paredit_electric_return && getline('.') =~ '^\s*\(\]\|}\)' && &ft =~ '.*\(clojure\|scheme\|racket\).*' + elseif g:paredit_electric_return && getline('.') =~ '^\s*\(\]\|}\)' && &ft =~ '.*\(clojure\|scheme\|racket\|hy\).*' " Re-gather electric returns in the current line for ']' and '}' normal! k while getline( line('.') ) =~ '^\s*$' @@ -865,7 +865,7 @@ function! PareditInsertClosing( open, close ) normal! Jl return endif - if len(nextline) > 0 && nextline[0] =~ '\]\|}' && &ft =~ '.*\(clojure\|scheme\|racket\).*' + if len(nextline) > 0 && nextline[0] =~ '\]\|}' && &ft =~ '.*\(clojure\|scheme\|racket\|hy\).*' " Re-gather electric returns in the line of the closing ']' or '}' call setline( line('.'), substitute( line, '\s*$', '', 'g' ) ) normal! Jxl @@ -1495,7 +1495,7 @@ function! s:FindClosing() endif call setpos( '.', [0, l, c, 0] ) - if &ft =~ '.*\(clojure\|scheme\|racket\).*' + if &ft =~ '.*\(clojure\|scheme\|racket\|hy\).*' call PareditFindClosing( '[', ']', 0 ) let lp = line( '.' ) let cp = col( '.' ) @@ -1749,5 +1749,6 @@ endif if !exists("g:paredit_disable_scheme") au FileType scheme call PareditInitBuffer() au FileType racket call PareditInitBuffer() + au FileType hy call PareditInitBuffer() endif