How can I indent lines selected in Visual mode using space granularity instead of than TABs (i.e. <
or >
)?
Sometimes when coding Python, I need to indent lines to a level that is not a TAB boundary.
Selecting the lines by pressing V
to enter Visual mode and then using <
or >
to indent them doesn't let me indent the lines to the anticipated level.
Any ideas?
Update:
Suppose after some edits, the dots ('.
') are not aligned, which they must be in order to satisfy the Flake8 Python linter:
# Flake8: All dots ('.') should be aligned over each other
proj_object = self.session.query(Project) \
.filter(Project.id == parsed_proj.id) \
.one_or_none()
In particular, all dots must have the same indentation as the topmost dot, which is not on a TAB boundary. It's very cumbersome to manually ident each line individually using SPACEs... I'd like to indent all lines in Visual mode at once using SPACEs (not TABs):
# Flake8: No complains
proj_object = self.session.query(Project) \
.filter(Project.id == parsed_proj.id) \
.one_or_none()
NB: I have looked at expandtab
, but that doesn't really suit my needs.
expandtab
sounds like what you are looking for. Could you explain why that doesn't suit your needs? It would be nice that you edit your question with a snippet of code and what you actually want to do with it otherwise it will be hard to help you.autoindent
andsmartindent
or maybe the lsp for python to handle this gracefully.