Switch clojure provider, closes #685

This commit is contained in:
Adam Stankiewicz
2021-04-14 12:04:39 +02:00
parent 8c28a9cfca
commit 7d0a1706ec
6 changed files with 103 additions and 94 deletions

View File

@@ -57,7 +57,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
- [caddyfile](https://github.com/isobit/vim-caddyfile) - [caddyfile](https://github.com/isobit/vim-caddyfile)
- [carp](https://github.com/hellerve/carp-vim) (Syntax highlighting for carp files) - [carp](https://github.com/hellerve/carp-vim) (Syntax highlighting for carp files)
- [cjsx](https://github.com/mtscout6/vim-cjsx) - [cjsx](https://github.com/mtscout6/vim-cjsx)
- [clojure](https://github.com/guns/vim-clojure-static) (Clojure syntax highlighting for clj, boot, cl2, cljc, cljs, cljs.hl, cljscm, cljx, hic and edn files) - [clojure](https://github.com/clojure-vim/clojure.vim) (Clojure syntax highlighting for clj, boot, cl2, cljc, cljs, cljs.hl, cljscm, cljx, hic and edn files)
- [cmake](https://github.com/pboettch/vim-cmake-syntax) (CMake syntax highlighting for cmake and cmake.in files) - [cmake](https://github.com/pboettch/vim-cmake-syntax) (CMake syntax highlighting for cmake and cmake.in files)
- [coffee-script](https://github.com/kchmck/vim-coffee-script) (CoffeeScript and Literate CoffeeScript syntax highlighting for coffee, cake, cjsx, iced, coffeekup, cson, litcoffee and coffee.md files) - [coffee-script](https://github.com/kchmck/vim-coffee-script) (CoffeeScript and Literate CoffeeScript syntax highlighting for coffee, cake, cjsx, iced, coffeekup, cson, litcoffee and coffee.md files)
- [cpp-modern](https://github.com/bfrg/vim-cpp-modern) - [cpp-modern](https://github.com/bfrg/vim-cpp-modern)

File diff suppressed because one or more lines are too long

View File

@@ -3,13 +3,13 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'clojure', 'ftplugin/clojure.v
endif endif
" Vim filetype plugin file " Vim filetype plugin file
" Language: Clojure " Language: Clojure
" Author: Meikel Brandmeyer <mb@kotka.de> " Maintainer: Alex Vear <av@axvr.io>
" " Former Maintainers: Sung Pae <self@sungpae.com>
" Maintainer: Sung Pae <self@sungpae.com> " Meikel Brandmeyer <mb@kotka.de>
" URL: https://github.com/guns/vim-clojure-static " URL: https://github.com/clojure-vim/clojure.vim
" License: Same as Vim " License: Vim (see :h license)
" Last Change: %%RELEASE_DATE%% " Last Change: %%RELEASE_DATE%%
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
finish finish
@@ -21,7 +21,7 @@ set cpo&vim
let b:undo_ftplugin = 'setlocal iskeyword< define< formatoptions< comments< commentstring< lispwords<' let b:undo_ftplugin = 'setlocal iskeyword< define< formatoptions< comments< commentstring< lispwords<'
setlocal iskeyword+=?,-,*,!,+,/,=,<,>,.,:,$ setlocal iskeyword+=?,-,*,!,+,/,=,<,>,.,:,$,%,&,\|
" There will be false positives, but this is better than missing the whole set " There will be false positives, but this is better than missing the whole set
" of user-defined def* definitions. " of user-defined def* definitions.
@@ -47,7 +47,7 @@ setlocal commentstring=;\ %s
" specially and hence are not indented specially. " specially and hence are not indented specially.
" "
" -*- LISPWORDS -*- " -*- LISPWORDS -*-
" Generated from https://github.com/guns/vim-clojure-static/blob/%%RELEASE_TAG%%/clj/src/vim_clojure_static/generate.clj " Generated from https://github.com/clojure-vim/clojure.vim/blob/%%RELEASE_TAG%%/clj/src/vim_clojure_static/generate.clj
setlocal lispwords=as->,binding,bound-fn,case,catch,cond->,cond->>,condp,def,definline,definterface,defmacro,defmethod,defmulti,defn,defn-,defonce,defprotocol,defrecord,defstruct,deftest,deftest-,deftype,doseq,dotimes,doto,extend,extend-protocol,extend-type,fn,for,if,if-let,if-not,if-some,let,letfn,locking,loop,ns,proxy,reify,set-test,testing,when,when-first,when-let,when-not,when-some,while,with-bindings,with-in-str,with-local-vars,with-open,with-precision,with-redefs,with-redefs-fn,with-test setlocal lispwords=as->,binding,bound-fn,case,catch,cond->,cond->>,condp,def,definline,definterface,defmacro,defmethod,defmulti,defn,defn-,defonce,defprotocol,defrecord,defstruct,deftest,deftest-,deftype,doseq,dotimes,doto,extend,extend-protocol,extend-type,fn,for,if,if-let,if-not,if-some,let,letfn,locking,loop,ns,proxy,reify,set-test,testing,when,when-first,when-let,when-not,when-some,while,with-bindings,with-in-str,with-local-vars,with-open,with-precision,with-redefs,with-redefs-fn,with-test
" Provide insert mode completions for special forms and clojure.core. As " Provide insert mode completions for special forms and clojure.core. As
@@ -61,21 +61,6 @@ for s:setting in ['omnifunc', 'completefunc']
endif endif
endfor endfor
" Take all directories of the CLOJURE_SOURCE_DIRS environment variable
" and add them to the path option.
"
" This is a legacy option for VimClojure users.
if exists('$CLOJURE_SOURCE_DIRS')
for s:dir in split($CLOJURE_SOURCE_DIRS, (has("win32") || has("win64")) ? ';' : ':')
let s:dir = fnameescape(s:dir)
" Whitespace escaping for Windows
let s:dir = substitute(s:dir, '\', '\\\\', 'g')
let s:dir = substitute(s:dir, '\ ', '\\ ', 'g')
execute "setlocal path+=" . s:dir . "/**"
endfor
let b:undo_ftplugin .= ' | setlocal path<'
endif
" Skip brackets in ignored syntax regions when using the % command " Skip brackets in ignored syntax regions when using the % command
if exists('loaded_matchit') if exists('loaded_matchit')
let b:match_words = &matchpairs let b:match_words = &matchpairs

View File

@@ -3,14 +3,13 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'clojure', 'indent/clojure.vim
endif endif
" Vim indent file " Vim indent file
" Language: Clojure " Language: Clojure
" Author: Meikel Brandmeyer <mb@kotka.de> " Maintainer: Alex Vear <av@axvr.io>
" URL: http://kotka.de/projects/clojure/vimclojure.html " Former Maintainers: Sung Pae <self@sungpae.com>
" " Meikel Brandmeyer <mb@kotka.de>
" Maintainer: Sung Pae <self@sungpae.com> " URL: https://github.com/clojure-vim/clojure.vim
" URL: https://github.com/guns/vim-clojure-static " License: Vim (see :h license)
" License: Same as Vim " Last Change: %%RELEASE_DATE%%
" Last Change: %%RELEASE_DATE%%
if exists("b:did_indent") if exists("b:did_indent")
finish finish
@@ -29,7 +28,7 @@ setlocal indentkeys=!,o,O
if exists("*searchpairpos") if exists("*searchpairpos")
if !exists('g:clojure_maxlines') if !exists('g:clojure_maxlines')
let g:clojure_maxlines = 100 let g:clojure_maxlines = 300
endif endif
if !exists('g:clojure_fuzzy_indent') if !exists('g:clojure_fuzzy_indent')
@@ -61,7 +60,8 @@ if exists("*searchpairpos")
endfunction endfunction
function! s:ignored_region() function! s:ignored_region()
return s:syn_id_name() =~? '\vstring|regex|comment|character' let name = s:syn_id_name()
return (name =~? '\vstring|regex|comment|character') && (name !~# '^clojureCommentReaderMacro\(Form\)\?$')
endfunction endfunction
function! s:current_char() function! s:current_char()
@@ -174,7 +174,35 @@ if exists("*searchpairpos")
call search('\S', 'W') call search('\S', 'W')
let w = s:strip_namespace_and_macro_chars(s:current_word()) let w = s:strip_namespace_and_macro_chars(s:current_word())
if g:clojure_special_indent_words =~# '\V\<' . w . '\>' if g:clojure_special_indent_words =~# '\V\<' . w . '\>'
" `letfn` is a special-special-case.
if w ==# 'letfn'
" Earlier code left the cursor at:
" (letfn [...] ...)
" ^
" Search and get coordinates of first `[`
" (letfn [...] ...)
" ^
call search('\[', 'W')
let pos = getcurpos()
let letfn_bracket = [pos[1], pos[2]]
" Move cursor to start of the form this function was
" initially called on. Grab the coordinates of the
" closest outer `[`.
call cursor(a:position)
let outer_bracket = s:match_pairs('\[', '\]', 0)
" If the located square brackets are not the same,
" don't use special-case formatting.
if outer_bracket != letfn_bracket
return 0
endif
endif
return 1 return 1
endif endif
@@ -192,9 +220,10 @@ if exists("*searchpairpos")
endfunction endfunction
" Check if form is a reader conditional, that is, it is prefixed by #? " Check if form is a reader conditional, that is, it is prefixed by #?
" or @#? " or #?@
function! s:is_reader_conditional_special_case(position) function! s:is_reader_conditional_special_case(position)
return getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?" return getline(a:position[0])[a:position[1] - 3 : a:position[1] - 2] == "#?"
\|| getline(a:position[0])[a:position[1] - 4 : a:position[1] - 2] == "#?@"
endfunction endfunction
" Returns 1 for opening brackets, -1 for _anything else_. " Returns 1 for opening brackets, -1 for _anything else_.

View File

@@ -376,7 +376,7 @@ filetypes:
- carp - carp
--- ---
name: clojure name: clojure
remote: guns/vim-clojure-static remote: clojure-vim/clojure.vim
filetypes: filetypes:
- name: clojure - name: clojure
linguist: Clojure linguist: Clojure

File diff suppressed because one or more lines are too long