I am trying to add a shortcut or a button in notepad++ to call an external program on the file I am currently editing.
For example, let's say I have the program "analyzer.jar". I would like to create a button (or shortcut) in notepad++ that would directly run the command "cmd -K java -jar analyzer.jar "$(FULL_CURRENT_PATH)".
Since I haven't found any solution yet, any help would be deeply appreciated :).
Well, in fact I found how easy it is to create a shortcut for a command:
Go in the menu and select "Run → Run..." (or press f5)
Type your command
Click on "Save", and select the keyboard shortcut of your choice
Sometimes, when you look for complicated solutions, you don't see the simple ones...
Related
I try to download file using Autoit from Firefox 28.0.
I try to download a exe file,popup flashed but autoit window info tool cannot recognize the save button.
how can i automate this.
My scripts looks like
Local $hWnd=WinActivate("[CLASS:MozillaDialogClass]")
WinWaitActive($hWnd)
;MsgBox(1,$hWnd,$hWnd)
;ControlClick($hWnd,"","Save")
ControlClick($hWnd,"&Save File","")
;WinClose("[CLASS:MozillaDialogClass]")
how can i automate this......
Right now both of your ControlClick attempts are incorrect. The correct syntax is ControlClick(Window title or handle, *window* text, control *id*, ...). Look at the helpfile and examples for it to see what you're not doing right currently.
The firefox download dialog is a little tricky, googling gives a lot of results for people who have tried to do the same thing and struggled.
The easiest method is to click the window at the coordinates of the button. ControlClick can be used for this (simply leave the control id blank). The AutoIt window info tool should give ControlClick coords when you try and select where the button is.
That method does assume that the button is always in the same place, which is not necessarily the case. Alternatives are to use ControlSend to send the Alt+S combination (or whatever it is for that button).
And finally, it's worth mentioning the IUIAutomation framework which has shown to be very reliable for automating windows that aren't using standard winapi controls.
The simplest way to do is as follows on mozilla:
Use the following code on autoit.au3 file
ControlFocus ( "MozillaDialogClass", "", "" )
Sleep(10)
Send("{ENTER}")
Execute the same file in selenium using:
Runtime.getRuntime().exec("C:\\Users\\Balaji\\Desktop\\autoit.exe");
Use the below code to download a file in Firefox using AutoIt.
WinWait("[TITLE:Opening ; CLASS:MozillaDialogClass]","", 10)
If WinExists("[TITLE:Opening ; CLASS:MozillaDialogClass]") Then
; Perform keyboard ALT key + s key to select Save File Radio button using keyboard shortcut.
ControlFocus ( "[TITLE:Opening ; CLASS:MozillaDialogClass]","", "" )
Send("!s")
; Wait for 2 seconds
Sleep(2000)
; Press Keyboard ENTER button.
Send("{ENTER}")
EndIf
I'm using Aptana Studio 3 and am looking for a command that will take me to the previous editor I was in (a la Netbeans ctrl-tab or Eclipse's ctrl-F6). I've tried several commands with promising sounding names but none of them seem to behave properly. Any thoughts?
Go to Windows->Preferences->General->Keys and have a look at the key binding you have set for the commands 'Next Editor' and 'Previous Editor'. Type those commands in the filter search box to save yourself having to scroll.
On Windows the shortcuts for next and previous editor are in fact Ctrl+F6 and Ctrl+Shift+F6 respectively, which also happen to be the defaults in Eclipse. So if your key bindings for those commands are not set then you can set them here.
(1) For example, I want to set map gd g* in Qt's Fakevim like below but failed.
(2) And also I'd like to set F3 as the save command, how to do it?
(3) In Fakevim, it provides an option "Read .vimrc", but where to find the file .vimrc?
Thank you!
It doesn't look like there is a lot of documentation for FakeVim, so official sources might not exist. Most of this was obtained by experimentation.
If you want to dig deeper, I guess there's no source as official as the actual source: http://qt.gitorious.org/qt-creator/qt-creator/blobs/0809986e501415fe2c8508800b94b5b3169dc048/src/plugins/fakevim/fakevimplugin.cpp
User commands
First off, realize that in Tools>Options>FakeVim>User Command Mapping, you're only setting what your user actions will perform, not how you perform them.
By default, user command #1 is triggered by pressing Alt-V, then 1.
Alt-V, then 2, triggers user action #2, and so on.
You can change the keyboard shortcuts through the general QtCreator configuration interface, under Tools>Options>Environment>Keyboard. There is a "FakeVim" section with all the user actions listed. Select your user action of choice, press the little "erase" icon in the input field under "Shortcut", then press your desired shortcut key, which should appear in the input field.
Second, to finish a command where you would normally press enter, you should literally type in <CR> after the commands. You also need to enter in ':' to enter command mode.
So if you wanted to map the vim save command, ":w", to F3 via FakeVim, you would:
Go to Tools>Options>FakeVim>User Command Mapping.
Enter ":w<CR>" as one of the user commands (say #7).
Go to Tools>Options>Environment>Keyboard.
Find the FakeVim action "UserAction7".
Set F3 as a shortcut for it.
Now, every time you're in the editor, you should be able to click F3 and have the FakeVim :w command execute, which will save your file.
Note that there is also an option to set a shortcut for "Save" directly in the QtCreator keyboard settings, so for this particular shortcut you don't actually need to go through FakeVim.
Setting shortcuts for other vim commands should be similar. Note that you're restricted to the subset of vim commands that FakeVim implements. Refer to the source, linked above, for checking any particular command you're wondering about.
Vimrc file
On Linux this would be ~/.vimrc, a file in the user's home directory. I presume you're asking about Windows.
The best source I can find is this bug report about it being hard to use Fakevim's vimrc on Windows: https://bugreports.qt.io/browse/QTCREATORBUG-8748
Following that, the file Fakevim looks for is ".vimrc" in %USERPROFILE% (you can enter a name like that in Explorer to go to the folder). However, it's tricky to access a file with a name like that on Windows. (Thus why the real vim uses '_vimrc' on Windows -- but FakeVim apparently doesn't, at least at the moment.)
Here is a superuser page with workarounds for how to create such files on Windows: https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows
My .zshrc file contains the line
bindkey -v
I'm attempting to bind ^q or \M-q to push-line, e.g.
bindkey "^q" push-line
but for some reason it isn't working.
Running `bind key -v' confirms
"^Q" push-line
But it doesn't actually do anything. Other control- mappings, such as ^r, work fine.
I can successfully map "push-line" to "\eq", but I don't like this behavior. First of all, I never use esc- type bindings, and secondly doing so binds it to control, meta, and escape, which is overkill. (Incidentally, shouldn't it only bind all of them like that with `bindkey -m'? I never set that in my .zshrc?)
So, anybody have any idea what's going on here?
These shortcuts are used by Software flow control (wikipedia)
Ctrl+S and Ctrl+Q are used to stop and resume the output of a program.
To try it:
Run while (true) ; do echo $RANDOM ; sleep 1 ; done
Press Ctrl+S, the output stop.
Press Ctrl+Q, the output resume.
(I'm not sure the program is stopped like with Ctrl+Z, i think it is stuck by lack of outputting. Ctrl+C to kill the program.)
These shortcuts take over your shortcuts, but if you disable this flow control feature, it could work.
You can learn how to disable it in How to unfreeze after accidentally pressing Ctrl-S in a terminal? - Unix and Linux.
Try it and tell us.
Is there a way to open vim in a new shell window or tab? I'm used to doing $ mate file, which opens the file in a new window.
I prefer having one 'central shell' where I issue commands and edit files in other windows or tabs, as necessary. How do people normally open vim files locally?
from inside vim, use one of the following
open a new window below the current one:
:new filename.ext
open a new window beside the current one:
:vert new filename.ext
You can do so from within vim, using its own windows or tabs.
One way to go is to utilize the built-in file explorer; activate it via :Explore, or :Texplore for a tabbed interface (which I find most comfortable).
:Texplore (and :Sexplore) will also guard you from accidentally exiting the current buffer (editor) on :q once you're inside the explorer.
To toggle between open tabs, use gt or gT (next tab and previous tab, respectively).
See also Using tab pages on the vim wiki.
I use this subtle alias:
alias vim='gnome-terminal -- vim'
-x is deprecated now. We need to use -- instead
If you don't mind using gVim, you can launch a single instance, so that when a new file is opened with it it's automatically opened in a new tab in the currently running instance.
to do this you can write: gVim --remote-tab-silent file
You could always make an alias to this command so that you don't have to type so many words.
For example I use linux and bash and in my ~/.bashrc file I have:
alias g='gvim --remote-tab-silent'
so instead of doing $ mate file I do: $ g file
I'm using the following, though it's hardcoded for gnome-terminal. It also changes the CWD and buffer for vim to be the same as your current buffer and it's directory.
:silent execute '!gnome-terminal -- zsh -i -c "cd ' shellescape(expand("%:h")) '; vim' shellescape(expand("%:p")) '; zsh -i"' <cr>
Check out gVim. You can launch that in its own window.
gVim makes it really easy to manage multiple open buffers graphically.
You can also do the usual :e to open a new file, CTRL+^ to toggle between buffers, etc...
Another cool feature lets you open a popup window that lists all the buffers you've worked on.
This allows you to switch between open buffers with a single click.
To do this, click on the Buffers menu at the top and click the dotted line with the scissors.
Otherwise you can just open a new tab from your terminal session and launch vi from there.
You can usually open a new tab from terminal with CTRL+T or CTRL+ALT+T
Once vi is launched, it's easy to open new files and switch between them.