Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CanYouJustWorkPlease/cfc394d94c64f2cc2a2a4a0f68ca9221 to your computer and use it in GitHub Desktop.
Save CanYouJustWorkPlease/cfc394d94c64f2cc2a2a4a0f68ca9221 to your computer and use it in GitHub Desktop.
Notepad++ bookmarks list window
# Code taken from https://community.notepad-plus-plus.org/topic/16965/bookmarks-list-window?_=1685007314263
# Writen by Eko palypse
# Edited by CanYouJustWorkPlease
# Changed bookmarker_id = 1<<24 to bookmarker_id = 1<<20 according to this post:
# https://community.notepad-plus-plus.org/post/82616
# Value was changed because the script wouldn't work with Notepad++ v8.5.3 (32-bit)
# Script can be run by using https://github.com/bruderstein/PythonScript , a python plugin for Notepad++
# A better alternative to this script is https://github.com/Dook1/Bookmarks-Dook
# This line clears any existing console output
console.clear()
# This line shows the console if it's hidden
console.show()
# Get the current filename from Notepad
_filename = notepad.getCurrentFilename()
# Create an empty list to store marker line numbers
markers = []
# Set the bookmarker ID to a large number
bookmarker_id = 1<<20
# Find the first occurrence of a marker with the specified ID
markerLine = editor1.markerNext(0, bookmarker_id)
# Loop through all marker occurrences and add their line numbers to the markers list
while markerLine > -1:
markers.append(markerLine)
markerLine = editor1.markerNext(markerLine+1, bookmarker_id)
# Loop through each marker line number in the list and print the line along with its file name and line number
for line in markers:
print ' File "{}", line {:<10} {}'.format(_filename, line+1, editor.getLine(line).strip()[:100])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment