Skip to content
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

fmt.vim: fix cursor staying on the same line when goimports is used #1367

Merged
merged 1 commit into from
Jul 22, 2017

Conversation

fatih
Copy link
Owner

@fatih fatih commented Jul 22, 2017

fixes #1342

@fatih fatih merged commit ab0df08 into master Jul 22, 2017
@fatih fatih deleted the improve-cursor-replacement-fmt branch July 22, 2017 21:41
@@ -95,6 +97,9 @@ function! go#fmt#Format(withGoimport) abort
" Restore our cursor/windows positions.
call winrestview(l:curw)
endif

" be smart and jump to the line the new statement was added/removed
call cursor(line('.') + diff_offset, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! That would do it. I'm guessing the second argument to cursor() is the column number?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using goimports for go_fmt_command moves the cursor on save
2 participants