Skip to content

Use javascript indent #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,37 @@ automatically enabled anytime you edit a `.ts` file.
Indenting
---------

This plugin includes a custom indenter (based on `indent/java.vim`), it works
pretty well but there are cases where it fails. If these bother you or want to
use other indent settings you can disable it by setting a flag in your
This plugin includes a custom indenter (based on [pangloss/vim-javascript's
indenter](https://github.com/pangloss/vim-javascript/blob/master/indent/javascript.vim)),
it works pretty well but there are cases where it fails. If these bother you or
want to use other indent settings you can disable it by setting a flag in your
`.vimrc`:

```vim
let g:typescript_indent_disable = 1
```

If you want the indenter to automatically indent chained method calls as you type.

```typescript
something
.foo()
.bar();
```

Then add something like `setlocal indentkeys+=0.` to your `.vimrc`, see `:help
'indentkeys'` in vim for more information.

If you use the `=` operator to re-indent code it will always indent
chained method calls - this can be disabled by changing the regex the
indent script uses to identify indented lines. In this case removing '.'
from the regex means that it wont indent lines starting with '.'. Note,
this is not ideal as the regex may change making your setting out of date.

```vim
let g:typescript_opfirst='\%([<>=,?^%|*/&]\|\([-:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)'
```

Compiler settings
-----------------

Expand Down
Loading