Giter Site home page Giter Site logo

seanfxyz / vim-lambdify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from calebsmith/vim-lambdify

0.0 0.0 0.0 104 KB

Vim plugin that conceals lambda/function syntax with lambda characters

License: BSD 2-Clause "Simplified" License

Makefile 10.02% Vim Script 34.42% Erlang 12.52% Scheme 26.83% Python 0.70% Ruby 0.92% C# 5.19% Clojure 1.64% JavaScript 2.40% Elm 2.72% Haskell 2.64%

vim-lambdify's Introduction

vim-lambdify

A vim plugin that conceals lambdas/inline functions with a lambda character for various languages

vim-lambdify-example

Requirements

Vim >= 7.3 (for the conceal feature)

Some file types rely on syntax files built-in to Vim >= 7.4

Installation

If you are using Vundle or NeoBundle, add this to your list of bundles::

Plugin 'calebsmith/vim-lambdify'

For vim-plug use:

Plug 'calebsmith/vim-lambdify'

Another option is manually copying the /after/syntax files into ~/.vim/after/syntax and /autoload/vimlambdify.vim into ~/.vim/autoload

A third option is to clone this repo and run make, which will automatically do the work of copying the appropriate files to a location within ~/.vim

Overview

Vim's conceal feature allows for some text to be replaced with something else for display purposes, without changing the underlying representation of what is saved into the file. Plugins such as vim-haskellConceal and vim-cute-python use this to replace many different things with more pithy/mathy symbols. The approach taken here is to replace only lambdas, but to do so for many different languages to avoid having to use many plugins for a single feature.

Additionally, some plugins lose syntax highlighting for concealed characters. vim-lambdify makes efforts to ensure highlighting is kept.

At the moment, the following languages have lambda conceal support through vim-lambdify:

  • Clojure
  • Scheme
  • Erlang
  • Haskell
  • Elm
  • Python
  • Ruby
  • JavaScript
  • Java
  • C#

N.B.

The vim-polyglot plugin is a dependency for the JavaScript arrow function (=>) to work properly, since the default syntax file is outdated.

For Java it's necessary to change this line in the default Java syntax file ($VIMRUNTIME\syntax\java.vim):

syn match javaError "<<<\|\.\.\|=>\|||=\|&&=\|[^-]->\|\*\/"

to:

syn match javaError "<<<\|\.\.\|=>\|||=\|&&=\|\*\/"

Otherwise the -> operator will be highlighted as error by default. You can use the vim-java plugin, that already has this correction.

More will likely be added over time. These just happen to be languages I use frequently that have lambdas or something akin to them.

Feel free to open a pull request to incorporate an unsupported language.

Acknowledgements

Many thanks for the ideas and some implementation details taken from the following plugins:

  • Twinside/vim-haskellConceal
  • ehamberg/vim-cute-python
  • dkinzer/vim-schemer
  • tyok/js-mask

vim-lambdify's People

Contributors

calebsmith avatar adelarsq avatar ethagnawl avatar rohanorton avatar seanfxyz 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.