From f8c2f99cd87b024d035e29815f7af32b414124e9 Mon Sep 17 00:00:00 2001 From: Tamas Kovacs Date: Fri, 22 Jan 2021 17:55:26 +0100 Subject: [PATCH] Add option g:slimv_indent_disable to disable slimv's indenting --- doc/slimv.txt | 12 ++++++++++-- ftplugin/slimv.vim | 12 ++++++++---- indent/clojure.vim | 5 +++-- indent/lisp.vim | 6 +++--- indent/scheme.vim | 5 +++-- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/doc/slimv.txt b/doc/slimv.txt index d41c6631..d9a4f8c3 100644 --- a/doc/slimv.txt +++ b/doc/slimv.txt @@ -1,4 +1,4 @@ -*slimv.txt* Slimv Last Change: 05 Oct 2019 +*slimv.txt* Slimv Last Change: 22 Jan 2021 Slimv *slimv* Version 0.9.14 @@ -165,10 +165,13 @@ For the Swank options plese visit |swank-configuration|. |g:slimv_impl| The Lisp implementation. Defaults to 'clisp'. +|g:slimv_indent_disable| Disable slimv indenting, fallback to vim's + default lispindent() method. + |g:slimv_indent_keylists| Enable special indentation for keyword lists. |g:slimv_indent_maxlines| Maximum number of lines searched backwards for - indenting special forms + indenting special forms. |g:slimv_inspect_name| Name of the Inspect buffer. @@ -581,6 +584,11 @@ the end of the form is not echoed, so paren balance is kept. If this option is set to zero then no line is echoed at all, if set to -1 then all lines are always echoed. + *g:slimv_indent_disable* +Disable slimv indenting and use vim's built-in ispindent() method. +Please note that this option does not completely disable the indenting, +only changes the way s-expressions are indented. + *g:slimv_indent_keylists* If nonzero then Slimv indents keyword lists like that: diff --git a/ftplugin/slimv.vim b/ftplugin/slimv.vim index 955ef6ba..c604939f 100644 --- a/ftplugin/slimv.vim +++ b/ftplugin/slimv.vim @@ -1,6 +1,6 @@ " slimv.vim: The Superior Lisp Interaction Mode for VIM " Version: 0.9.14 -" Last Change: 30 Sep 2019 +" Last Change: 22 Jan 2021 " Maintainer: Tamas Kovacs " License: This file is placed in the public domain. " No warranty, express or implied. @@ -1929,9 +1929,13 @@ endfunction " Indentation routine, keeps original cursor position function! SlimvIndent( lnum ) - let oldpos = getpos( '.' ) - let indent = SlimvIndentUnsafe( a:lnum ) - call cursor( oldpos[1], oldpos[2] ) + if exists("g:slimv_indent_disable") && g:slimv_indent_disable + let indent = lispindent( a:lnum ) + else + let oldpos = getpos( '.' ) + let indent = SlimvIndentUnsafe( a:lnum ) + call cursor( oldpos[1], oldpos[2] ) + endif return indent endfunction diff --git a/indent/clojure.vim b/indent/clojure.vim index dca92091..6b550e27 100644 --- a/indent/clojure.vim +++ b/indent/clojure.vim @@ -1,7 +1,7 @@ " clojure.vim: " Clojure indent plugin for Slimv " Version: 0.9.14 -" Last Change: 05 Apr 2017 +" Last Change: 22 Jan 2021 " Maintainer: Tamas Kovacs " License: This file is placed in the public domain. " No warranty, express or implied. @@ -10,7 +10,8 @@ " ===================================================================== " " Load Once: -if exists("b:did_indent") || exists("b:slimv_did_indent") || exists("g:slimv_disable_clojure") +if exists("b:did_indent") || exists("b:slimv_did_indent") || exists("g:slimv_disable_clojure") || +\ (exists("g:slimv_indent_disable") && g:slimv_indent_disable) finish endif diff --git a/indent/lisp.vim b/indent/lisp.vim index 9723d69f..b45ad613 100644 --- a/indent/lisp.vim +++ b/indent/lisp.vim @@ -1,7 +1,7 @@ " lisp.vim: " Lisp indent plugin for Slimv -" Version: 0.9.5 -" Last Change: 21 Feb 2012 +" Version: 0.9.14 +" Last Change: 22 Jan 2021 " Maintainer: Tamas Kovacs " License: This file is placed in the public domain. " No warranty, express or implied. @@ -10,7 +10,7 @@ " ===================================================================== " " Load Once: -if exists("b:did_indent") +if exists("b:did_indent") || (exists("g:slimv_indent_disable") && g:slimv_indent_disable) finish endif diff --git a/indent/scheme.vim b/indent/scheme.vim index 90be4322..167e8c4e 100644 --- a/indent/scheme.vim +++ b/indent/scheme.vim @@ -1,7 +1,7 @@ " scheme.vim: " Scheme indent plugin for Slimv -" Version: 0.9.5 -" Last Change: 21 Feb 2012 +" Version: 0.9.14 +" Last Change: 22 Jan 2021 " Maintainer: Tamas Kovacs " License: This file is placed in the public domain. " No warranty, express or implied. @@ -11,6 +11,7 @@ " " Load Once: if exists("b:did_indent") || exists("g:slimv_disable_scheme") +\ (exists("g:slimv_indent_disable") && g:slimv_indent_disable) finish endif