How to use Jedit as the external editor of 7zip - 7zip

I am trying to use Jedit as an external editor to 7zip.
7zip opens Jedit as external editor however edits are only saved back if Jedit was not running previously. I probably should pass -noserver or -newview command line arguments to Jedit as an external editor, but when I do that 7zip gives an error: 'Cannot start editor'.
How could I use Jedit as an external editor to 7zip so that edits are saved back?

You cannot give arguments to the programs you configure in 7-Zip.
What you need to do is to create a batch file that you call from 7-Zip that sets the options you want to have and that forwards all other arguments.
What you do NOT want to do is to use the -noserver option without a -settings option if a jEdit instance is already running. Currently jEdit does not behave nice if you start two really separated instances in the same settings directory, as the first that writes a specific settings file after the second instance is started "owns" it and the other just does not save it anymore, so your positions, recent files, changed settings etc. will not be persisted and there is no prominent warning about this.
What you DO want to do is to use the -wait option, that is present for exactly those cases.
So create a file jedit-wait.bat (e. g. in the jEdit installation directory) with content #jedit -wait %* and then configure that batch file as 7-Zip editor. That is also how I have set it up and it works exactly like expected. The only slightly unnice thing is, that you will have a black command line window sitting there as long as you edit the file, but that is not as disturbing as it sounds, at least to me.

Related

ActivePerl. .pl files no longer execute but open in Notepad instead

I have perl scripts which were running in Windows 7 just fine as of this morning. I made the mistake of using NotePad as the default for opening/editng my .pl files. Now, when I attempt to run the unedited .pl files from a DOS prompt, the script does not execute but opens the associated source code file in Windows Explorer. This is the same for all my .pl files no matter the complexity (including classic "hello world".
I have been researching changes need to the registry - it all looks fine. Tried assoc and ftype changes - nothing. Tried reinstalling ActivePerl - no solution.
You don't need to go into the Registry.
Go into Windows Explorer.
Find a file that ends in a *.pl suffix.
Right click on it and bring up the Context menu.
Select "Open With" (It might just be Open... with an ellipse after it. I don't have a Windows machine at the moment to verify this). This will bring up a dialog box with all the various programs. NOTE: Perl may not be listed in the initial set of programs. No worry, just navigate to it.
On the bottom of the dialog box is a checkbox (Something like open all extensions with this program). Make sure that checkbox is checked.
After this, all files that end with *.pl will open with Perl instead of Notepad.
It is highly likely that someone did this with a Perl script in order to edit it, and messed up the file association.
However, who ever did this should be doped slap -- not for messing up the file association, but for editing a program with Notepad. Bad Developer! No doughnuts for you!
Programs should be opened with a Program Editor. If you're a real he-man, you can use VIM. VIM is a fast, and powerful program editor, but you will need to spend an internship at the feet of a VIM Ninja master in order to learn how to use it. Your first three to six months with VIM will be What a idiotic program! This is awful. Who wrote this crap?. Then, one day, you will understand its power and efficiency. You will be one with the program.
If you aren't brave or fearless or don't have six months to waste learning a programming editor, you can use Notepad++. Compared to VIM Notepad++ is like driving a Minivan. It's safe, it's practical, and it gets the job done.
Both editors do Syntax Highlighting which can help you find issues. Both, (VIM can -- I think Notepad++ can too) offer help with syntax and usage. Both can edit a file without messing up the line endings (They'll both detect whether a file has Unix or Windows line endings and keep those or allow you to convert them). Both will number your lines, have extensive cut/paste buffers, powerful search and replace features. And will not mess up your file encoding. Both offer visual diffing between files and do automatic backups when you edit a file.
Finally, these two editors will embed themselves into the context menu you get when you right click on a file. You can edit a file by clicking on it, and selecting VIM or Notepad++ directly from the context menu. No need to select "Open with..." and possibly mess up the file suffix association.
Never ever use Notepad to edit a program.
Sounds like your .pl extention association is now set to Notepad rather than perl.exe. If you are too busy to fix that, just type "perl yourscript.pl" in a command promot window to start the perl interpreter and to send your script to it to run.
See this answer to fix the association:
File Type .pl Association and Using cmd.exe to Run the Script
I have the same problem. None of the method mentioned above solve the problem. The problem actually came from Windows 7! Windows 7 Doesn't allow you to associate .pl to perl.exe in c:\Perl64 directory, for whatever reason.
Here is the solution:
If you look at c:\Perl64\Bin directory (or the path where your ActivePerl binary installed), you'll see another file: Perl5.14.2.exe. This is the same file as perl.exe in same directory but with version number attached as postfix in the name.
You can associate .pl file to that Perl5.14.2.exe instead of perl.exe. Bingo, it works now.

How to change the path for "run command" "notepad"?

Where is in the registry the path executed when I run the "notepad" command in windows "Start->run command" interface? I want to change it for notepad++ (it is required so, although could look not really good)
If you are like me you use windows run command all the time. I hate using the mouse to point and click a shortcut on the start menu. WIN-R are probably the two most over used keys on my keyboard. After thinking about if awhile I hunted down how the run command works. It turns out that it makes a call to ShellExecute, which I guess is not too surprising. The next thing I wanted to find out was exactly how the commands are resolved. The following is an ordered list of how they are resolved ([1]):
The current working directory
The Windows directory (no subdirectories are searched)
The Windows\System32 directory
Directories listed in the PATH environment variable
The App Paths registry key
Naturally the next thing I wanted to do was customize existing commands or add new commands so I do not have to type as much (standard lazy approach). After examining my options which were to put the executable in one of those paths (since it only locates executables and not shortcuts), modify the path environment variable or add a key to App Paths. The App Paths option seems to be the easiest and most flexible to me. Here is a layout of what you need to do to add an App Paths entry ([1]):
HKEY_LOCAL_MACHINE-->
SOFTWARE-->
Microsoft-->
Windows-->
CurrentVersion==>
App Paths-->
file.exe-->
(Default) = The fully-qualified path and file name
Path = A semicolon-separated list of directories
DropTarget = {CLSID}
Disclaimer: Modifying the registry can cause serious problems that may require you to reinstall your operating system. I cannot guarantee that problems resulting from modifications to the registry can be solved. Use the information provided at your own risk.
The minimum needed to add a new entry is to add the key file.exe where file is the string you want to type into the run command and to add the Default entry which is the fully-qualified path to the file you want to execute. Note that even it the file you are going to reference isn't an exe file you still need to put the .exe on the key. Here is a sample registry file that I created to add a shorter keyword for Internet Explorer:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\ie.exe] #="C:\Program Files\Internet Explorer\iexplore.exe"
After entering that entry into the registry I can simply type “ie” at
the run command to open internet explorer.
Here is a list of some common commands I use at the run command:
cmd – Command prompt winword – Microsoft Word excel – Microsoft Excel
outlook – Microsoft Outlook iexplore – Internet Explorer firefox –
Mozilla Firefox notepad – Notepad compmgmt.msc – Computer Management
Console control appwiz.cpl – Add/Remove programs dialog mstsc –
Microsoft Terminal Service Client regedit – Registry Editor
…
If there is some program that I find myself using all the time I figure out what the run command is for it and if there is not a short easy one I add one to my App Paths as described above. Does anyone else have some other common run commands they use?

Permamently amend Vim font size

Warning: first-time Vim "user"
I'd like to make the GUI font much bigger.
It is installed on a modern windows 32-bit machine.
I've used the Edit menu and found a good font using Select Font...
Then I entered the command:
set gfn?
To return ...
guifont=Consolas:h16:cANSI
Now apparently I need to add something to my vimrc file. I think I have found the file here?:
So why am I now struggling to make the changes?
Whichever way I try (notepad or via Vim>Open) to open this file it seems to be read-only.
I assume once open I need to add something like the following at some point(?) in the file?
if has('gui_running')
set guifont=Consolas:h16:cANSI
endif
Because your _vimrc lives under Program Files, Windows is trying to protect you from potentially damaging the system (and is preventing potentially malicious programs from doing the same).
In order to edit your _vimrc, you need to be running Vim as administrator. Right-click the gVim icon and select Run as administrator from the menu. You should then be able to edit the file.
You'll probably want to make lots of other changes to this file over time; you'll have to remember always to edit it as administrator.
I don't know much about the windows platform, but it seems that you were editing the system vimrc. try to start (g)vim, and type :e $MYVIMRC this should be user-lvl. usually under $HOME
write the setting you want there, and save.
or you could in vim, :echo $HOME, to see which dir is your HOME. then create the _vimrc file there.

Arbitrary .cmd script as screensaver in Windows 7 / XP

I have a fullscreen OpenGL application, written in Scala. It is supposed to being launched as .cmd file that sets up classpath (some .class files, some of them are third-party libraries and optionally in .jars) and runs JVM with the right parameters. I'm wondering, is there an easy way to use this .cmd file as Windows screensaver? (without usual screensaver preview and settings dialog, they are not needed there) I guess I need to register the application somewhere? Is there any restriction on what file type it must be?
You can install a screensaver by doing as #Kevin suggested and right click the file and install (provided that this is a .scr file). Or you can copy the file straight to C:\Windows or sometimes C:\Windows\system32.
However, unless the file is a valid screensaver then it won't show up in the list of screensavers when you choose which one you want, so I think you are out of luck.
Unless you created your own screensaver, and then you might be able to launch the file from one of the events it has.

Hide Vim backups (*~) in Windows Explorer

On Windows, I normally work with Total Commander, which can easily be configured to ignore these *.*~ and *~ completely. But occasionally when I switch to Windows Explorer, I get little bit confused with all that "unknown" files/.
Can I set up Vim so that for every backup it creates it will also set "hidden" attribute?
Or set up some nice workaround?
I know I can set up Vim to put these in other directory, but I'd like to avoid that, since IIUC, it could suffer from naming conflicts.
If the backup option is set, vim updates the backup file every time we write the file with :w. And every time, it creates a file which is not hidden even though you had forcibly hidden it previously! So we need to do something everytime we write the buffer into file.
You can do this on windows. In your _vimrc file ( generally found at C:\Program Files (x86)\Vim ), add this line
autocmd BufWritePost,FileWritePost * silent ! attrib +h <afile>~
Where,
attrib=Windows File attribute changinf command
<afile>= Name of the file being sourced
silent= Prevent an annoying command window from popping up and asking user to press a key
This will make sure that the backup file gets hidden with every write to file from buffer. Why every time? Cos vim creates a non-hidden file at every write!
But you have to live with a flashing black window ( command window where we are running attrib command ) every time you save your file, but worth the pain :)
On linux/unix systems you can add this in your .vimrc
autocmd BufWritePost,FileWritePost * silent ! mv <afile>~ .<afile>
Hope this helps all those trying to find how to hide vim backup files.
I wrote a plugin for this a while back called autohide. It works by setting the "hidden" attribute after write as suggested in Pavan's answer. By default it only does this for swap files, viminfo, and persistent undo files; you can make it only hide backup files by configuring let g:autohide_types='b' in your .vimrc, or add it to the default list instead with 'suvb' instead of just 'b'.
Benefits over the manual method in Pavan's answer include handling of additional file types, arbitrary file patterns (like dotfiles), and some error handling (especially related to slow network shares that don't allow setting attributes right away after creating a file).
I have this in my _gvimrc:
set nobackup
No backup files are generated in the first place.
However, the swap file (.*.swp) is still generated during editing (and deleted when you close Vim). So if your computer crashes, you can still recover your changes.

Resources