dart-lang / dart-vim-plugin

Syntax highlighting for Dart in Vim
BSD 3-Clause "New" or "Revised" License
640 stars 55 forks source link

How do I indent my code with tabs? #113

Closed ProgrammingLife closed 3 years ago

ProgrammingLife commented 4 years ago

I've noticed about:

Enable Dart style guide syntax (like 2-space indentation) with let g:dart_style_guide = 2

but I wanna indent my code with tabs. How can I get it?

I can't use spaces because I will not be able to turn on highlighting for hierarchy like this:

set listchars=tab:\┆\ ,trail:•,extends:»,precedes:«
set list
theniceboy commented 4 years ago

You can't, unfortunately.

natebosch commented 3 years ago

but I wanna indent my code with tabs. How can I get it?

If you aren't setting the g:dart_style_guide variable this plugin should not impact your indent settings.

See :help expandtab and :help ftplugin for general vim information on setting indent options in vim. This is unrelated to this plugin.

In particular you either want an ftplugin/dart.vim file with

setlocal noexpandtab

or in your vimrc

augroup dart-indent
  autocmd!
  autocmd FileType dart setlocal noexpandtab
augroup END

If you are indenting with tabs you should not use :DartFmt. The Dart formatter only support spaces for indent so you'll need to manually format your code.