Skip to content

Instantly share code, notes, and snippets.

@boonshift
Created May 20, 2021 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save boonshift/2e241311c58e019b74b8f35d1ed28981 to your computer and use it in GitHub Desktop.
Save boonshift/2e241311c58e019b74b8f35d1ed28981 to your computer and use it in GitHub Desktop.
Pin some specific files via IntelliJ's IDE Scripting Console
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
val b = bindings as Map<String, Any>
val IDE = b["IDE"] as com.intellij.ide.script.IDE
val editor = FileEditorManagerEx.getInstance(IDE.project) as FileEditorManagerEx
val filesToPin = editor.openFiles.filter { it.name.contains("Scratch") }
filesToPin.forEach { f -> editor.currentWindow.setFilePinned(f, true) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment