question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding extra line from vim

See original GitHub issue

I’m not sure how to determine if this is caused by vim or prettier, so sorry in advance if it is caused by vim.

After installing prettier globally and adding autocmd FileType javascript set formatprg=prettier\ --stdin to my .vimrc, I am seeing the following.

Initial state:

function test() {
  return 'hello';
}

Action: Type gggqG, which selects the whole file and runs prettier on it. Unfortunately, the formatting part works, but I am left with an extra newline at the end of the file. The same thing happens if you go in visual mode, select the whole file and type gq.

Let me know if there is any other info that would be helpful or if there is any way I can help. Thank you so much for your work, I have been loving prettier so far!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kmcqcommented, Jan 23, 2017

Thanks @lydell!

0reactions
lydellcommented, Jan 23, 2017

This happens because console.log() adds yet a newline at the end of file. This is not specific to vim. PR coming soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inserting a blank line in vim? - Super User
Press Enter to insert a blank line below current, Shift + Enter to insert it above. Share.
Read more >
How to insert a newline without leaving normal mode
Put those lines in your vimrc . Then go to the beginning of the second line of your file and hit Space ,...
Read more >
Vim: two methods to append blank lines under multiple text lines
My instinctive solution was to go to each line in Normal mode, type “O” (“o” uppercase) to activate the Insert mode and adding...
Read more >
How to add a line after every few lines in vim - Stack Overflow
%s is vim ex command to substitute in the whole file ·.*\n is a line including the end of line · \0 is...
Read more >
How do I add a Space to Selected Lines within VIM? - Fir3net
1. Within VIM select blockwise visual mode, by pressing CTRL-V. · 2. Use the cursor keys to select the lines you want to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found