-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Numbered, upper case and multicursor register #974
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5786b6a
Added basic numbered register for yank&delete
6db2718
Added test and fixed RegisterContent Typo
151bc60
added appending with normal- and multicursor
fc06a48
Added tests for appending in normal mode
5e8e8c2
Added @jpoon remarks from PR #918
eb995d2
fixed error when reuse numbered registers
9a4f78f
Merge branch 'master' into register-rampage
jpoon 71161d0
correct spelling mistake in comments
8d70152
fix wrong appending from normal to multic register
de89d0d
Merge branch 'register-rampage' of https://github.com/Platzer/Vim int…
36498d3
Merge branch 'master' into register-rampage
jpoon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we read
files.eol
to use the proper line ending of the file? https://code.visualstudio.com/Docs/customization/userandworkspaceThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines only apply when we read from the system clipboard. The problem is vscode automaticaly transforms
\n
to\r\n
when your EOL is set toCRLF
, so when we're on a windows machine the EOL is\r\n
if i would paste that vscode transforms it to\r\r\n
and you've got two linebreaks in the editor.My first idea was to get the current EOL setting from the active editor but i didn't found the vscode API, you can set it but i don't found where i can read the setting???
As i can't go that way, my next idea was check the OS if we're on windows replace the newline char with the vscode-vim internal newline ('\n' we use it everywhere), but then i thought safe me the check and replace it everytime because on windows it fixes the double newline and on unix systems it causes no harm because there is no
\r\n
in the clipboard.What do you think, is it better to add the OS check so it is more obvious that it should only apply to windows machines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following should work:
let eol = vscode.workspace.getConfiguration('files').get("eol", "\n");
and then you can add this as a new member to
configuration.ts
to expose it to your current functionality.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So when i think about it the "The default end of line character" (comment for the setting) is not the problem, i would need the "current system clipboard end of line character" because i had to romve the
\r
only on windows because vscode adds it when\n
is inserted. And in case of unix system replacing\n
with\n
is unnecessary.See the behavior i get on my machine (WIN7 with EOL = CRLF):
Every replace i do the
\n
is turned into\r\n
so\n
is the universial newline character in vscode?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, very interesting behaviour. I repro that on my mac and I see what you mean, in that case using
\n
is the way to go.