Imbuter2000 Posted December 4, 2012 Share Posted December 4, 2012 Is there in SciTE a keyboard shortcut for jumping to the beginning of the function the cursor is in? I feel many times the need of it.... having many and long functions... Link to comment Share on other sites More sharing options...
BrewManNH Posted December 4, 2012 Share Posted December 4, 2012 SciteJump should be able to help with that. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
guinness Posted December 4, 2012 Share Posted December 4, 2012 As BrewManNH said, SciTE Jump. Hit Ctrl + J in SciTE if you're using SciTE4AutoIt3 and look in my signature for the latest version. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Developers Jos Posted December 4, 2012 Developers Share Posted December 4, 2012 The way I read the question is that the OP is somewhere working in the FUNC-ENDFUNC itself and want to jump to the first line of the FUNC. Ctrl-J works out of the box when you have the full version of SciTE loaded, and jump from a Function reference to the FUNC Definition. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Imbuter2000 Posted December 5, 2012 Author Share Posted December 5, 2012 The way I read the question is that the OP is somewhere working in the FUNC-ENDFUNC itself and want to jump to the first line of the FUNC.Yes Jos correctly understood my different question: I would a shortcut that when my cursor is somewhere inside FUNC-ENDFUNC jumps to the FUNC line.Ctrl+J doesn't do this and neither do SciTE jump Link to comment Share on other sites More sharing options...
Developers Jos Posted December 5, 2012 Developers Share Posted December 5, 2012 Ctrl+J doesn't do this and neither do SciTE jump Correct, as I stated, that jumps from a Func Refference to the FUNC definition.There is no buildin way to jump to the top of the FUNC you are working in.I am sure it is possible but can't see the general use of it to build this in via a LUA script option.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
jdelaney Posted December 5, 2012 Share Posted December 5, 2012 How large a function is this? Maybe it would be better to have the function built with other function calls, to keep it from growing too large. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Imbuter2000 Posted December 5, 2012 Author Share Posted December 5, 2012 Correct, as I stated, that jumps from a Func Refference to the FUNC definition.There is no buildin way to jump to the top of the FUNC you are working in.I am sure it is possible but can't see the general use of it to build this in via a LUA script option.Jos I'ld like it mainly for two uses:- when I want to add local or global variables at the beginning of the current function- when I want to (fastly) read the function from the beginning of it for remind Link to comment Share on other sites More sharing options...
Developers Jos Posted December 5, 2012 Developers Share Posted December 5, 2012 (edited) This is a lua func that should be close to what you want. It uses Ctrl+u to jump up to FUNC and also uses Ctrl+Shift+J to Jump back. Add this to sciteuser.properties: # 35 Jump up to Func def command.name.35.$(au3)=Jump up to Func begin command.mode.35.$(au3)=subsystem:lua,savebefore:yes command.shortcut.35.$(au3)=Ctrl+u command.35.$(au3)=InvokeTool AutoItGotoDefinition.GobacktoDefinition Add this to file AutoItGotoDefinition.lua expandcollapse popup-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- GobacktoDefinition() -- -- Jumps up to a function definition. -- -- Tool: AutoItGotoDefinition.GobacktoDefinition $(au3) savebefore:yes Ctrl+u Goto Definition -------------------------------------------------------------------------------- function AutoItGotoDefinition:GobacktoDefinition() -- Get current pos local Pos_Carret = editor.CurrentPos -- get current text local text = editor:GetText() -- Force to lower case text = text:lower() local Next_Pos_Func = 0 local Next_Pos_EndFunc = 0 local Pos_Func = 0 local Pos_EndFunc = 0 -- Look for the Func definition above current line and find belonging EndFunc. repeat Pos_Func = Next_Pos_Func Pos_EndFunc = Next_Pos_EndFunc Next_Pos_Func = text:find("func .*%(", Pos_Func + 1) if Next_Pos_Func ~= nil then Next_Pos_EndFunc = text:find("endfunc", Next_Pos_Func + 1) end until Next_Pos_Func == nil or Next_Pos_Func > Pos_Carret -- if Pos_Func == nil then Pos_Func = 0 end if Pos_EndFunc == nil then Pos_EndFunc = 0 end -- Check if we found a Func definition above the Carret and an EndFunc below the carret to ensure we are inside an Func. -- set up a marker and go to the function. if Pos_Func ~= 0 and Pos_Func < Pos_Carret and Pos_EndFunc > Pos_Carret then -- save current location if props['SciteLastJumpFromFile'] == nil or props['SciteLastJumpFromFile'] == "" then props['SciteLastJumpFromFile'] = string.gsub(props["FilePath"],"\\","\\\\") .. "|" props['SciteLastJumpFromPos'] = editor.CurrentPos .. "|" else props['SciteLastJumpFromFile'] = string.gsub(props["FilePath"],"\\","\\\\") .. "|" .. props['SciteLastJumpFromFile'] props['SciteLastJumpFromPos'] = editor.CurrentPos .. "|" .. props['SciteLastJumpFromPos'] end editor:EnsureVisible(editor:LineFromPosition(Pos_Func)) editor:GotoLine(editor:LineFromPosition(Pos_Func)) end end -- GobacktoDefinition() Enjoy, Jos Edited December 26, 2012 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Imbuter2000 Posted December 6, 2012 Author Share Posted December 6, 2012 This is a lua func that should be close to what you want. It uses Ctrl+u to jump up to FUNC and also uses Ctrl+Shift+J to Jump back. Add this to sciteuser.properties: # 35 Jump up to Func def command.name.35.$(au3)=Jump up to Func begin command.mode.35.$(au3)=subsystem:lua,savebefore:yes command.shortcut.35.$(au3)=Ctrl+u command.35.$(au3)=InvokeTool AutoItGotoDefinition.GobacktoDefinition Add this to file AutoItGotoDefinition.lua -------------------------------------------------------------------------------- -- GobacktoDefinition() -- -- Jumps up to a function definition. -- -- Tool: AutoItGotoDefinition.GobacktoDefinition $(au3) savebefore:yes Ctrl+u Goto Definition -------------------------------------------------------------------------------- function AutoItGotoDefinition:GobacktoDefinition() -- Get current pos local cpos = editor.CurrentPos -- get current text local text = editor:GetText() -- Force to lower case text = text:lower() local pos = 0 local lpos = 0 -- Look for the function definition above current line. repeat lpos = pos pos = text:find("func .*%(", pos + 1) until pos == nil or pos > cpos -- We found a function definition, set up a marker and go to the function. if lpos ~= nil and lpos ~= 0 and lpos < pos then -- save current location if props['SciteLastJumpFromFile'] == nil or props['SciteLastJumpFromFile'] == "" then props['SciteLastJumpFromFile'] = string.gsub(props["FilePath"],"","") .. "|" props['SciteLastJumpFromPos'] = editor.CurrentPos .. "|" else props['SciteLastJumpFromFile'] = string.gsub(props["FilePath"],"","") .. "|" .. props['SciteLastJumpFromFile'] props['SciteLastJumpFromPos'] = editor.CurrentPos .. "|" .. props['SciteLastJumpFromPos'] end editor:EnsureVisible(editor:LineFromPosition(lpos)) editor:GotoLine(editor:LineFromPosition(lpos)) end end -- GobacktoDefinition() Enjoy, Jos WOW! There's only a problem: after I added and saved those pieces of codes to the two files, I restarted SciTE and tried the keyboard shortcuts and nothing happened Link to comment Share on other sites More sharing options...
Developers Jos Posted December 7, 2012 Developers Share Posted December 7, 2012 WOW! There's only a problem: after I added and saved those pieces of codes to the two files, I restarted SciTE and tried the keyboard shortcuts and nothing happened Works for me, tried in on a clean install of SciTE4AutoIt3.It doesn't do anything when there is no FUNC above the caret, else it will go to the first FUNC up. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
JohnOne Posted December 7, 2012 Share Posted December 7, 2012 (edited) I tried it, perhaps I did something wrong but I get this error output... ...ram FilesAutoIt3SciTELuaAutoItGotoDefinition.lua:328: attempt to compare number with nil >Lua: error occurred while processing command EDIT: Line is in the new definition... if lpos ~= nil and lpos ~= 0 and lpos < pos then Edited December 7, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 7, 2012 Developers Share Posted December 7, 2012 (edited) if lpos ~= nil and lpos ~= 0 and lpos < pos then Yeap ... that statement is wrong and should be: if lpos ~= nil and lpos ~= 0 and lpos < cpos then Let me know if that solves it. Jos Edited December 7, 2012 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
JohnOne Posted December 7, 2012 Share Posted December 7, 2012 That fixes it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Imbuter2000 Posted December 9, 2012 Author Share Posted December 9, 2012 (edited) Works for me, tried in on a clean install of SciTE4AutoIt3.It doesn't do anything when there is no FUNC above the caret, else it will go to the first FUNC up.ah, damn, I tried it while inside a function of your file AutoItGotoDefinition.lua without notifing that it's not an AutoIT code! the function code there starts with "function" instead than "func".On AutoIT code it works! )) thanks!!! Edited December 9, 2012 by Imbuter2000 Link to comment Share on other sites More sharing options...
Developers Jos Posted December 9, 2012 Developers Share Posted December 9, 2012 Sweet, I will leave the code in the production LUA file but probably won't add the shortcut to au3.properties unless there is a greater demand for it. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Imbuter2000 Posted December 11, 2012 Author Share Posted December 11, 2012 Update about my main uses of these shortcuts: - when I want to add local or global variables at the beginning of the current function - when I want to check or modify the parameters passed to the current function - when I want to read again the function from the beginning of it for remind Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 11, 2012 Moderators Share Posted December 11, 2012 Imbuter2000,Just an aside on that list - declaring Global variables within a function should be avoided. Although the code will still run, AU3Check will give you a warning as it is considered bad coding practice - Global variables should really be declared at the top of the script. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Imbuter2000 Posted December 11, 2012 Author Share Posted December 11, 2012 (edited) There's a little bug/lack in the ctrl+U function: when you use it while your cursor is out of any function it jumps to the first previous "func" (if any), despite the fact that your cursor is not inside it. I know that it's not usually recommended to have (non function) code after a function but I would expect it to jump to the absolute beginning of the code in that case. Jumping to the first previous "func" made my (wrongly) believe that cursor was inside that function... Edited December 11, 2012 by Imbuter2000 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 11, 2012 Moderators Share Posted December 11, 2012 Imbuter2000, Perhaps reorder your script so that there is no code after the final function. You are quite correct that it is not recommended - so why do it? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now