Giter VIP home page Giter VIP logo

sanecl's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=2951

Bug reports or comments welcome! Email: [email protected]
----------------

Parsing is done using a per character tokenizer. Two stacks are used to simulate a recursive parse.

Mappings:
<Tab> indents lines (or ranges in visual mode)
<C-\> indents the toplevel form. Or whatever is at 150[(.

To indent an entire file, do 1GVG<Tab>. This may take a while for a large file.

Commands:
:CLLoadLispwords refreshes the lisp word file
:CLIndentForm indents the toplevel form
:CLIndentRange indents a range
:CLIndentLine indents a line
:CLSetWord <word> <number> sets a lispword

Customizable variables:
String :: g:CL_lispwords_file defaults to ~/lispwords.
Boolean :: g:CL_aggressive_literals defaults to 1
Boolean :: g:CL_retab_on_open defaults to 1
Integer :: g:CL_auto_zero_limit defaults to 25
List <String> :: g:CL_loop_keywords lists all known loop keywords
List <String> :: g:CL_flets lists forms to be handled similar to flet
List < List < String, Integer > > :: g:CL_auto_prefixes lists all regexp base lisp numbers.

Add <<let g:VARIABLE = VALUE >> to your ~/.vimrc to change this. For Boolean variables, 1 is true and 0 is false.

Lisp words are stored 1 per line as such:
<symbol> <lisp #>

Aggressive literals means that forms such as (:hello world), ('got milk) and (&optional var1 var2) are treated as literals. The first character of the first symbol (if it is a symbol) are tested to match [&':].

While indenting, auto prefixes iterates over each string-integer pair. If the string matches the parent (for example "def" matches "defclass", and "^[abc].*$" matches "chair"), then the associated lisp word number is used for indentation. The first match wins.
I default to: [["with-",1], ["def",2], ["make-",1], ["map",1]]

Auto zero limit was added to preserve screen real estate for long lispy symbol names. If a symbol in your program looks like "variable-that-holds-an-integer-and-is-used-for-counting", you may appreciate this setting. Any parent string longer than the limit will be handled as a lisp number zero. By default, this is 25 characters.

My lispwords file is available at: http://paste.lisp.org/display/97882
It is not complete, but might be a useful starting point.

The indentation behavior was based on a description at http://evalwhen.com/scmindent/index.html.

sanecl's People

Stargazers

Eric O'Connor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.