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

VIM-1062 #333

Merged
merged 3 commits into from
Jul 1, 2021
Merged

VIM-1062 #333

merged 3 commits into from
Jul 1, 2021

Conversation

MichalPlacek
Copy link
Contributor

https://youtrack.jetbrains.com/issue/VIM-1062
added:
:bn select the next editor tab, circling from the last to the first
:bp select the previous editor tab, circling from the first to the last
:bd or bdX

Copy link
Member

@AlexPl292 AlexPl292 left a comment

Choose a reason for hiding this comment

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

Thank you for your PR! Could you please check some comments?

resources/META-INF/includes/VimExCommands.xml Outdated Show resolved Hide resolved
override val argFlags = flags(RangeFlag.RANGE_OPTIONAL, ArgumentFlag.ARGUMENT_OPTIONAL, Access.READ_ONLY)
override fun execute(editor: Editor, context: DataContext, cmd: ExCommand): Boolean {
val arg = cmd.argument.trim()
if (arg.isNotEmpty() && arg.matches(Regex("^\\d+$"))) {
Copy link
Member

Choose a reason for hiding this comment

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

You can use toIntOrNull instead of regex check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it.

final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project);
final EditorWindow window = fileEditorManager.getCurrentWindow();
VirtualFile[] editors = fileEditorManager.getOpenFiles();
if (number == 99) {
Copy link
Member

Choose a reason for hiding this comment

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

Why 99 is a special number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was by mistake. i removed it.

if (number >= 0 && number < editors.length) {
fileEditorManager.closeFile(editors[number], window);
}
if (number < 0 || number >= editors.length) {
Copy link
Member

Choose a reason for hiding this comment

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

This if is empty

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was by mistake. i removed it.

@AlexPl292 AlexPl292 merged commit c15eccf into JetBrains:master Jul 1, 2021
@AlexPl292
Copy link
Member

That's great, thank you for your work!

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.

2 participants