jceb / vim-orgmode

Text outlining and task management for Vim based on Emacs' Org-Mode
http://www.vim.org/scripts/script.php?script_id=3642
Other
3.1k stars 266 forks source link

Correct indentation for description text #243

Closed schoettl closed 8 years ago

schoettl commented 8 years ago

Previous title: Indent in description gets lost when pressing <Esc> on empty line

Hi, first, thank you for this plugin! I think I really like it.

I just have a problem with indentation, e.g. I write this note:

* header
  indentation here is correct, then I type <CR> and
  press <Esc> to use \sa (insert date)
<2016-07-04 Mon>
  this is what happens. <C-t> / <Tab> (in insert mode)
  or >> (in normal mode) yields a wrong indentanion
  on this line

Is there a way to fix this? Or is it maybe because of my Vim configuration?

Ron89 commented 8 years ago

Vim remove autoindents on empty line when quit insert mode. To avoid this, a workaround could be

inoremap <esc> x<BS><esc>

Refer to: http://stackoverflow.com/questions/7413036/stopping-vim-from-removing-indentation-on-empty-lines

schoettl commented 8 years ago

Thank you Ron, ok that would work.

But I think this still might be general problem. Apart from that, I am not a fan of empty lines with white spaces.

What do you think of integrating mappings for >>, <Tab>, and <C-t> to indent correctly? Or only <C-t> for now?. I guess, such mappings would have to calculate the indent size dynamically. But it might be a usefull and comprehensive solution.

schoettl commented 8 years ago

I found the variable to disable indent for descriptions:

" default: 1; 0 solves the indentation problems
let g:org_indent = 0

I actually think 0 shoud be the default because it prevents many indentation problems.

Ron89 commented 8 years ago

I agree. It is actually what I did in my setting as well. And if I remember correctly, it is also the default of emacs's org mode. @jceb, your opinion?

On 8 Jul 2016, at 5:07 pm, Jakob Schöttl notifications@github.com wrote:

I found the variable to disable indent for descriptions:

" default: 1; 0 solves the indentation problems let g:org_indent = 0 I actually think 0 shoud be the default because it prevents many indentation problems.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

schoettl commented 8 years ago

You're right, Ron. Indentation is not default in emac's orgmode but must be turned on with org-indent-mode. Also, in emac's orgmode, it's only indented for display!

this kind of view can be achieved dynamically at display time using org-indent-mode.

http://orgmode.org/manual/Clean-view.html

Ron89 commented 8 years ago

OK, I just changed the default value like you suggested. :)

schoettl commented 8 years ago

Thank you :) I'll close this issue. And I have a pull request to update the documentation.

jceb commented 8 years ago

The whole indentation thing is different in Emacs orgmode as far as I can tell.  I observed that Emacs doesn't indent descriptions and level 1 lists at all but adds virtual visual indentation to everything below a heading.  I'd recommend that we adapt this for vim as well.

So g:org_indent should be 0 by default.  However, I'm not sure if this will break indentation for sub items in lists.  Sub items should be indented properly.

Ron89 commented 8 years ago

list/checkbox indentation is independent. This won’t break list structure.

On 8 Jul 2016, at 11:48 pm, Jan Christoph Ebersbach notifications@github.com wrote:

The whole indentation thing is different in Emacs orgmode as far as I can tell. I observed that Emacs doesn't indent descriptions and level 1 lists at all but adds virtual visual indentation to everything below a heading. I'd recommend that we adapt this for vim as well.

So g:org_indent should be 0 by default. However, I'm not sure if this will break indentation for sub items in lists. Sub items should be indented properly.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jceb/vim-orgmode/issues/243#issuecomment-231396059, or mute the thread https://github.com/notifications/unsubscribe/ACkkvTUiylCuSfOp6uAOR8OlESH4ZXuqks5qTnFXgaJpZM4JERi_.