ProductPromotion
Logo

Clojure

made by https://0x3d.site

GitHub - venantius/vim-cljfmt: A Vim plugin for cljfmt, the Clojure formatting tool.
A Vim plugin for cljfmt, the Clojure formatting tool. - venantius/vim-cljfmt
Visit Site

GitHub - venantius/vim-cljfmt: A Vim plugin for cljfmt, the Clojure formatting tool.

GitHub - venantius/vim-cljfmt: A Vim plugin for cljfmt, the Clojure formatting tool.

vim-cljfmt

vim-cljfmt is a vim plugin for cljfmt, the code formatting tool for Clojure(Script). Rather than invoking the plugin by shelling out to Leiningen, it uses a vim-fireplace REPL connection to only format the current file. This has the advantage of sidestepping Leiningen's startup time and keeping Vim from hanging, though the first time you use it with a given REPL server there will be a slight delay as it loads the cljfmt namespace.

Demo below:

Configuration and Usage

vim-cljfmt allows you to format the file in the current buffer with the following:

:Cljfmt

Of course, manually formatting files is for people who aren't lazy. So, by default, vim-cljfmt automatically does the formatting when you save. If you want to turn this off, add the following line to your .vimrc:

let g:clj_fmt_autosave = 0

If you need to pass custom configuration to cljfmt, you can do it like this:

let g:clj_fmt_config = '{:indentation? true, :remove-surrounding-whitespace? true, :remove-trailing-whitespace? true, :remove-consecutive-blank-lines? false, :insert-missing-whitespace? true, :align-associative? false, :indents {#"^\w" [[:inner 0]], #".*" [[:inner 0]]}}'

To format the code in current visual selection use the following command:

:'<,'>CljfmtRange
Re-starting the REPL while editing

If you expect the have to re-start the REPL while working, you have two options. You can manually re-load vim-cljfmt from within Vim with the following:

:CljfmtRequire

Alternatively, you can add the following line to your ~/.lein/profiles.clj:

:repl-options {:init (require 'cljfmt.core)}

The latter will slow down your REPL startup time, but will mean you won't have to do any extra typing if you restart your REPL. Personally, I prefer this approach.

Installation

Requirements

You'll want to have cljfmt and vim-fireplace installed, and you'll need to make sure Cljfmt is somewhere on your project's classpath. I'd recommend adding the following to your ~/.lein/profiles.clj:

:dependencies [[cljfmt "0.5.1"]]

You'll also need to have a REPL connection open through fireplace.

After that, the rest should take care of itself.

Installing with Pathogen

Assuming you already have Pathogen installed, you should be good to go with the following:

cd ~/.vim/bundle && \
git clone https://github.com/venantius/vim-cljfmt.git

Installing with Vundle

To install vim-cljfmt with Vundle, add the following line to your .vimrc:

Bundle 'venantius/vim-cljfmt'

Other Vim + Clojure Plugins

If you like this, you should check out vim-eastwood!

License

Copyright (c) 2015 W. David Jarvis.

Licensed under the Eclipse Public License, the same as Clojure.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory