Skip to content

Fix indentation when inserting new task and smartindent is on #14

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions ftplugin/tasks.vim
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,22 @@ function! s:NewTask(direction)
return
endif

let l:indendation = matchlist(l:project['line'], s:regProject)[1]
let l:indentation = matchlist(l:project['line'], s:regProject)[1]
let l:text = g:TasksMarkerBase . ' '

let l:smartindent = &smartindent
setlocal nosmartindent

if a:direction == -1
exec 'normal O' . l:indendation . l:text
exec 'normal O' . l:indentation . l:text
else
exec 'normal o' . l:indendation . l:text
exec 'normal o' . l:indentation . l:text
endif

exec 'normal >>'

let &smartindent = l:smartindent

startinsert!
endfunc

Expand Down