Adding extra line from vim
See original GitHub issueI’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:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @lydell!
This happens because
console.log()
adds yet a newline at the end of file. This is not specific to vim. PR coming soon.