app-assignment for vifm on windows - vifm

I'm on Win 10 and want to get rid of the Windows-Explorer and use mostly my keyboard with vifm.
But I have problems assigning a file extension to a specific app. Everything I want to open is opened with the built-in vim, instead of my external Apps.
Here is an Example from my config:
" Pdf
filextype *.pdf
\ {View in AR}
\ C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe %f
I have two Questions right now:
- Is there really no 'Open-With'-function in vifm? Can't believe....
- How do I correctly assign the file types in my win-environment?
Thanks 4 your support!!

There are two things that you need to fix with the command:
Escape spaces in path by enclosing it in quotes (vifm checks if programs are present and thus needs to be able to extract executable path from command-line).
Use Windows-friendly macro %"f instead of %f.
This will give you:
" Pdf
filextype *.pdf
\ {View in AR}
\ "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" %"f
Which should work.
Is there really no 'Open-With'-function in vifm?
Depends on what you mean. There is :file command, which will display
list of registered file associations. If you just want to go with those registered
in Windows, then use catch-all association filetype * start. If you're talking
about "Open with" menu like in Explorer, then no, such querying of registered
associations is not performed.

Late answer, but Xaizek's solution contains a few inaccuracies and isn't complete, since it is possible to get the open with dialogue if you're willing to jump through a tiny hoop:
To open pdf files by default with AcroRd32 you should add the following lines to your vifmrc:
filextype *.pdf
\ {View in AR}
\ "C:/Program Files (x86)/Adobe/Acrobat Reader DC/Reader/AcroRd32.exe" %"f &,
Note the forward slashes. Without these the command won't work. It's also generally a good idea to add &, at the end of any filextype line. This will allow acrord32 to open in the background and won't interrupt your vifm session; otherwise you'll have to close the pdf to continue using vifm.
On the second point, 'start' requires empty double quotes after it to work here:
filextype *.pdf
\ {View in default application}
\ start "" %"c &,
An alternative is to use explorer in place of start "". It's worth noting that this will only allow you to open one file a time instead of batch opening every selected pdf.
You can also open any file in a specific program via the shell, e.g. :!gvim %"c & will open the currently selected file in gvim. You may also replace %"c with any file name you want in the current directory.
Finally, you can get an open with dialogue for any selected file via the following method:
Create the file, ow.cmd, in your vifm directory (or any other location in your path) with the following contents:
Rundll32.exe shell32.dll,OpenAs_RunDLL %~1
Then add the following to your vifmrc:
" Create 'open with' dialogue box for selected file
nnoremap go :!ow.cmd %"c:p &<cr>
Now if you hit go within vifm it will bring up an 'open with' dialogue for the currently selected file. The external script is sadly necessary in order to remove the quotes from the file name that %"c:p tacks on.

Related

How to set silent_functions(1) as default in Octave? [duplicate]

I'm new to octave, and want to run a few commands on startup automatically every time it opens.
I typed "help startup" and saw "Octave uses the file ".octaverc". I did a bit of searching online at https://www.math.utah.edu/docs/info/octave_4.html, and saw the .octaverc file should be in the following path:
OCTAVE_HOME/lib/octave/VERSION/startup/octaverc
PROBLEM:
In that directory I don't have a startup folder, only "oct" and "site". I do see hidden files, which was my first thought since the file begins with "." character. So I then used Agent Ransack in the directory, and still nothing came up.
QUESTION:
1) Do I have to make the startup folder and octaverc file myself?
2) If so, does one, both or none have to be hidden?
3) Can it be a txt file, or does it have a special extension?
4) Do I just type the commands straight into the file or is there special formatting?
NOTE:
In case I'm going about this the wrong way, there are the operations I'd like to have run on startup:
PS1('>> '), addpath('D:\Users\Me\Desktop'), clc
Thanks ahead of time for the help!!
Possible locations (and their differences) for octaverc files are specified in the documentation.
In short, these are, from more general to specific:
octave-home/share/octave/site/m/startup/octaverc (most generic, for entire system)
octave-home/share/octave/version/m/startup/octaverc (to cover for more than one octave versions installed on the system, possibly requiring different startup scripts)
~/.octaverc (where ~ is unix-speak for a user's home directory -- covering for user-specific startup files)
.octaverc files in any directory, creating specific startup conditions for specific directories
octaverc files are effectively simple script files that are executed from most generic to most specific each time octave starts. Therefore, in the presence of conflicting commands, the more specific file can effectively be used to override the more generic behaviour.
Octave also supports (but does not recommend) the use of the startup.m file, for matlab compatibility.
You might also want to check out pathdef and savepath as well.
As a more general tip, if you ever want to search for a specific keyword from the documentation (e.g. octaverc), you can type this kind of search query in duckduckgo (or google):
octaverc site:https://octave.org/doc/interpreter/
(or just download the documentation as pdf and search the pdf)
Found the solution, the file was in the following path:
OCTAVE_HOME/share/octave/site/m/startup
to find out where OCTAVE_HOME is for you, just type "OCTAVE_HOME" into your Octave command line window.
ANSWERS:
1) You do not have to make a startup octaverc file yourself
2) The file is actually not hidden, so it should be easy to find given you're looking in the right place.
3) The file doesn't have an extension. It's just octaverc.
4) Under the last line of the existing file, you can just append commands as you would type them at the Octave command line window.
the last(7.3.0) octave version placed HERE:/ does not find the THERE:/openEMS/matlab directory even it is already loaded with octaverc or addpath. It keeps looking into the work dir where openEMS is not placed and does not recognize, for instance, the 'physical_constants.m' file.

Syntax for # literal in ms-access hyperlink?

This seems like it ought to be a trivial question, but I'm having a hell of a time finding an answer for this so far...
I have an access database that stores hyperlinks to files on a shared network drive. The link targets are specified as simple file paths (e.g. "G:\directoryname\filename.ext") rather than proper URL's ("http://domain.ext/link").
This works fine in general, but I've recently run into a problem involving file names that contain the "#" character. (It is not an option to change the file names to remove the # characters)
If I try to set up a link to something like "G:\directoryname\ExampleFile#24.pdf", then Access parses the # in the filename as it would generally do when it defines a hyperlink. The resulting target is just ""G:\directoryname\ExampleFile", with the portion of the link following the offending "#" simply being truncated.
Now, obviously if the link target were a regular URL, I would just replace the "#" in the text of the link with "%23" and there would be no issue.
The problem is that, if I do that here, my network file action fails, because unlike when opening a regular URL through a browser, the network doesn't recognize %23 as equivalent to # ( I get an error saying "Unable to open G:\directoryname\ExampleFile %23 24.pdf. Cannot open the specified file.")
Is there a more direct way to have ms-access record the link target with a literal # character included?
Well this certainly doesn't help you but here is your answer:
"You cannot use a pound character in a file name for a hyperlink in an Office program"
https://support.microsoft.com/en-us/kb/202261

Batch file short cut to open multiple IP based links in multiple tabs using Google Chrome

I'm trying to find a way to make a shortcut for Google Chrome that will open multiple IP based links in multiple tabs.
I have this line of code in the .bat file.
#echo off
start Chrome “111.95.192.176/Audit/WebPages/Login.aspx”
start Chrome “111.95.192.176/AirAudit/WebPages/Login.aspx”
start Chrome “111.95.192.176/Helpdesk/Login.aspx”
start Chrome “111.95.192.176/SPM_Audit/Login.aspx”
But in Google chrome it display some error after open the batch file (.bat)
This site can’t be reached
xn--http-uqa’s server DNS address could not be found.
ERR_NAME_NOT_RESOLVED
How could I resolve this error?
Note: In code IP address is not original one.
Command START interprets first double quoted string often as title string. Therefore it is advisable to explicitly define a title string which in case of starting a GUI application is simply an empty string.
Command processor interprets only straight double quotes " as double quote with special meaning. All other double quotes are interpreted literally.
To open multiple pages in Google Chrome specify all the URLs as arguments on one command line.
#echo off
start "" chrome.exe "111.95.192.176/Audit/WebPages/Login.aspx" "111.95.192.176/AirAudit/WebPages/Login.aspx" "111.95.192.176/Helpdesk/Login.aspx" "111.95.192.176/SPM_Audit/Login.aspx"
Of course there is no need to use a batch file at all as you can specify in shortcut chrome.exe with full path in double quotes and the URLs to open as arguments directly.
PS: Not tested with Google Chrome has I don't have this browser installed.
Got the correct code:
#echo off
start "" http:\\111.95.192.176/Audit/WebPages/Login.aspx
start "" http:\\111.95.192.176/AirAudit/WebPages/Login.aspx
start "" http:\\111.95.192.176/Helpdesk/Login.aspx
start "" http:\\111.95.192.176/SPM_Audit/Login.aspx
NOTE: Google Chrome is default web browser.

How to edit multiple files through "Find results" in Sublime Text

When I search multiple files via Command + Shift + F, the result is returned as something like a text file. This text file is editable, but changes made don't affect the original files.
Is it possible to do such that changes in "Find Results" propagates to the original source file?
The Find Results Apply Changes plugin was created to do just that.
You can install it through Package Control's "Install Package" option.
Before using this plugin, make sure that you have UTF-8 encoding enabled using the menu:
File > Save with Encoding > UTF-8
Once installed, you can apply any change you made to a "Find Results" buffer back to the files:
Search for "foo" in a folder (Sublime's default shortcut is CTRL+SHIFT+S)
This will open a "Find Results" buffer listing all the files with "foo" in it.
Change the instances of "foo" for "bar" or something else...
Go to the menu:
Find > Find Results - Apply Changes
This will write all the changes made back to the files and save the modified files automatically.
By default, using menus is the only way to make it work. However, it is quite tiresome and doesn't save as much time as it does with a keyboard shortcut. You can set your chosen keyboard shortcut by adding a new line in
Preferences > Key Bindings - User
by adding:
{ "keys": ["ctrl+r"], "command": "find_results_apply_changes" },
Don't use CTRL+S as it will overwrite saving file shortcut.
Warning!: According to the author of the plugin:
Uses regions to allow you do multiline changes, but when inserting new
newlines, will corrupt files if you commit more than once, this
because the new newlines will shift the line numbers. Will also
'corrupt' files if you add/remove newlines in other instances of the
modified files. eg in another tab. To prevent corruption this packages
will alert you and prevent most of these.
(This is a modified version of the description from the Find Results Apply Changes Github page.)
The shortest workaround I can think of would be to open the target file from search results by simply double clicking the path and then jumping to the according line using Ctrl+G on Windows or ⌃+G on Mac OS.
That's the way I do it and must say it is only a matter of seconds, even without the plugin.

Disable verbose output on build

When I use ST build system, "built-in output pane" prints various things like expected build output, but also cmd executed, active dir and path variable. Now cmd and dir are just fine, but printing path variable is totally unnecessary for me and it distracts actual output content, as it's just very long string of paths, shadowing all other output.
How can I instruct ST not to print path variable on build?
By adding "quiet": true to the Build System configuration file (JSON), you can prevent all "debug text" from appearing on build failure. This will include:
shell_cmd
cmd
dir
path
To exclude only path, you would need to modify the Packages/Default/exec.py file. Under the ExecCommand class, run method, look for self.debug_text += "[path: " and comment the line out.
To get to this file in ST3, you can use Package​Resource​Viewer, and type PRV: in the Command Palette to find Package​Resource​Viewer: Open Resource.
However, note that doing this, will create a file that will override the one that ships with ST3. So it is recommended to delete your override (Preferences -> Browse Packages from the menu, Default folder, exec.py) when a new build of ST comes out, as the official version may change to fix bugs etc. You can then re-apply your changes following the same steps as above, if it is still necessary. (Maybe an option will be added to exclude the path from the output, sometime in the future.)