Advertisement
alien_fx_fiend

[Feature Request] Use "Ctrl" + "[" "]" To Indent Line #5493

Jul 27th, 2019
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5493
  2. 1. Open the ‘Plugins Admin’ dialogue (Plugins > Plugins Admin...).
  3. 2. Install LuaScript plug-in.
  4. 3. Select Plugins > LuaScript > Edit Startup Script.
  5. 4. Add following lines to the Startup Script, and save the file (File > Save).
  6.  
  7. -- Mimic Brackets editor's "Ctrl+]"
  8. npp.AddShortcut("Increase Indentation", "Ctrl+]", function()
  9. local pos = editor.CurrentPos
  10. local lnn = editor:LineFromPosition(pos)
  11. local ipos = editor.LineIndentPosition[lnn]
  12. editor.LineIndentation[lnn] = editor.LineIndentation[lnn] + editor.TabWidth
  13. editor.CurrentPos = pos - ipos + editor.LineIndentPosition[lnn]
  14. end)
  15.  
  16. -- Mimic Brackets editor's "Ctrl+["
  17. npp.AddShortcut("Decrease Indentation", "Ctrl+[", function()
  18. local pos = editor.CurrentPos
  19. local lnn = editor:LineFromPosition(pos)
  20. local lni, tw = editor.LineIndentation[lnn], editor.TabWidth
  21. if tw <= lni then
  22. local ipos = editor.LineIndentPosition[lnn]
  23. editor.LineIndentation[lnn] = lni - tw
  24. editor.CurrentPos = pos - ipos + editor.LineIndentPosition[lnn]
  25. end
  26. end)
  27.  
  28. 5. Restart Notepad++ to activate the modified LuaScript Startup Script.
  29. 6. Verify the new entries in Plugins > LuaScript menu.
  30. 7. Open the ‘Shortcut mapper’ dialogue (Settings > Shortcut Mapper...).
  31. 8. Select ‘Scintilla commands’ tab.
  32. 9. Change or clear the shortcuts for SCI_PARAUP and SCI_PARADOWN.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement