GithubHelp home page GithubHelp logo

kbrose / atom-reindent Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 411 KB

Sane reindenting for the Atom text editor

Home Page: https://atom.io/packages/reindent

License: MIT License

JavaScript 100.00%
atom reindent indentation text-editor

atom-reindent's Introduction

reindent

Quickly re-indent your code!

demo.gif

(You will also need the python-indent package to achieve this exact behavior with Python files.)

Change the length of that variable name with impunity! Update your soft indentation length! Fix your co-workers mess! Fix your mess!

Usage

Highlight the lines of code you want to re-indent, and activate the re-indent command either through the command palette (ctrl-shift-p) or by using the keybinding ctrl-shift-r.

How?

This package:

  • expands your selection to include full lines,
  • splits the selected text along the file's newline (or \n if the file's newline character is unknown),
  • deletes that text,
  • re-inserts the text one line at a time with all preceding and trailing whitespace removed, running the command editor:newline after each line is inserted to automatically set the indentation level for the next line.

This package relies on Atom's built-in auto-indentation which is usually derived from a language package. If the language package doesn't do a good job of indenting your code, then this package will not either. In particular, languages with white-space based syntax (e.g. Python and Make) might have trouble.

The editor will take the first line of your selection as the base indentation level. Consider the code below:

for x in y:
 print(x)

If you highlight only the second line (print(x)) and reindent, then nothing will happen. You have to include the line for x in y: in your selection.

How to publish

I am by no means a master of the apm tool, so this I'm putting down the process for publishing.

  1. Make changes, merge into master etc.
  2. git checkout master
  3. git pull
  4. Edit the CHANGELOG, putting a line in for the new version.
  5. git add CHANGELOG.md; git commit -m "updating changelog"; git push
  6. If you're feeling paranoid, wait for CI to finish running on that push to master.
  7. apm publish [major | minor | patch | build] Note that this will automatically update package.json with the new version number!

https://github.com/kbrose/atom-reindent

atom-reindent's People

Contributors

kbrose avatar

Watchers

 avatar  avatar

Forkers

shaky4849

atom-reindent's Issues

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.