Giter Club home page Giter Club logo

juliaformatter.vim's Introduction

JuliaFormatter.vim

Plugin for formatting Julia code in (n)vim using JuliaFormatter.jl.

Install

Use any plugin manager:

vim-plug

Plug 'kdheepak/JuliaFormatter.vim'

dein.vim

call dein#add('kdheepak/JuliaFormatter.vim')

Vundle.vim

Plugin 'kdheepak/JuliaFormatter.vim'

Usage

Open any Julia file, type : to open the command prompt and type the following:

" format full file
:call JuliaFormatter#Format(0)
" format last/current selection
:call JuliaFormatter#Format(1)

You can remap this to a keyboard shortcut as well.

" normal mode mapping
nnoremap <localleader>jf :<C-u>call JuliaFormatter#Format(0)<CR>
" visual mode mapping
vnoremap <localleader>jf :<C-u>call JuliaFormatter#Format(1)<CR>

The (n)vim documentation recommends using <localleader> for a filetype plugin, but feel free to use <leader> or <localleader> for this remap. In (n)vim, both <leader> and <localleader> are set to the \ key by default.

Setting Format Options

To modify the formatting options can be modified by setting g:JuliaFormatter_options in your vimrc. An example of this is:

let g:JuliaFormatter_options = {
        \ 'indent'                    : 4,
        \ 'margin'                    : 92,
        \ 'always_for_in'             : v:false,
        \ 'whitespace_typedefs'       : v:false,
        \ 'whitespace_ops_in_indices' : v:true,
        \ }

See full list of options over on the JuliaFormatter API documentation.

Troubleshooting

See MINRC before opening an issue.

juliaformatter.vim's People

Contributors

kdheepak 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.