How to save file starting with . (dot) in Sublime without prompt - sublimetext3

When I try to save new file with filename starting with . (dot), Sublime prompts me, if I really want to do that.
Is there a way to make Sublime save the file without asking me? Either with configuration, 3rd party plugin or with my own. At this point I take anything.
I'm using Sublime 3.2.2 build 3211 on MacOS Big Sur

Related

Using Octave to "Edit" notepad file instead of "Open" in Windows

I use Windows 10 and an .exe program (in-house code written by a colleague) that imports data from .txt files. Since 99% of my use of .txt files are for this program, I've changed the default Windows program so that this .exe file is run automatically when opening a .txt file. If I need to access the .txt file directly, or use it for another purpose, I right-click and choose "edit."
I'm now writing a program of my own (using Octave 4.4.1), which also uses .txt files that sometimes need to be opened/edited, but if I use "open(filename)" in my Octave script, of course it just opens the .exe file. I can open the .txt file from there, but I'd like to skip this middle step, since the aforementioned .exe program is not intended to be used in this process, and there are other users of my code that don't have the .exe program installed.
Is there a way to duplicate the right-click/edit feature in Windows within Octave code? "edit(filename)" opens the file in the native Octave editor, which is technically viable, but not exactly a desirable scenario. I've also tried changing the default Octave editor to Notepad, and I've tried Notepad++ as well, but I have had absolutely no luck, even with significant effort, of making Octave use an external default editor of any kind (even when I remove the .exe program as the default for .txt files). Thanks in advance for any advice you can offer.
You can send command-line commands from Octave using the system() function.
For example, to open the file in notepad, you could do
[status, output] = system("notepad <path_to_text_file>.txt");
If notepad isn't in your system path, you will have to add it to or use the full path to the notepad executable
Or, if you want to use Notepad++, add it to your system path and then do
[status, output] = system("notepad++ <path_to_text_file>.txt");

Trying to open a python file in IDLE. Instead, a pycache folder is created. How do I fix this?

I have a number of python files with .py extensions that I was working on, closed, and tried to come back to later. When I tried to open them by right clicking and selecting “Edit with IDLE,” instead of opening a pycache folder was created.
I have a work around in which I go to edit the file with Notepad++, copy the text into a new python editor, delete the old file, and resave the new file with the same name. My research has turned up questions related to pycache and IDLE, but none specifically addressing the issue. Has anyone encountered a similar problem/know how to solve it? I’m running Python 3.5.2 on Windows 7.
What did you name the .py file as? If you named it something like "string.py", Python might interpret the file as one of those in the "Lib" folder. Why you can resave it with the same name and have it working afterwards is anyone's guess. I suggest just renaming the python file to something else.
I developed the bad habit of writing/editing python files with IDLE from watching intro videos when I was still relatively new to programming. I have since learned that file editors like Sublime or IDE's like PyCharm are a significantly better way to go and would highly recommend anyone reading this.
I had a similar issue. When I clicked "Edit with IDLE 3.6", it would create a "pycache" folder and not open the python file on IDLE.
I found a Reddit thread that gives an explanation here.
The reason the pycache folder is created is as follows:
When you import a module, Python stores the compiled bytecode in that
directory so that future imports can use it directly, rather than
having to parse and compile the source again. It does not do that for
merely running a script, only when a file is imported.
No such folder is created for the standard library, as the standard
library is pre-cached when you install Python
I was importing Python's "random" library, in another python file (placed in the same directory). So the issue was solved once I deleted that file.

How can I auto minify .js files to .min.js when saving the .js version in Sublime Text 3?

So I'm using Sublime Text 3 on OS X
I'm also using Minify
I know I can go into a .js file then Tools...Minify...Minify File and it creates the .min.js version in the same directory for me. This works fine but I'm forgetful. Is it possible (and if so how) to tap into Save in Sublime so that if I save a .js file it runs minify automatically for me?
Is this a case where I need a key binding for command + s that is smart enough to know if I'm saving a .js file and save/minify it if so and just do a standard save if not?
So far I've not found a good way to do this in Sublime Text but I did find CodeKit for OS X. CodeKit runs along side Sublime and not only does it auto minify .js files it also runs it through JSLint to help catch issues. (It does more than that)
Like Jason said, CodeKit is a great tool that runs along side sublime. Does compress LESS, SASS, CoffeeScript, JS, and I believe few more. That path for the compressed file is configurable. Once all files are set up, you leave CodeKit running and every single time you save a file in sublime CodeKit compiles. If you are running a local host I believe that your browser reloads as well.
When using Minify in Sublime Text, you can change the settings in Preferences -> Package settings -> Minify -> Settings - User, and add the line "auto_minify_on_save": true,. If the user settings are still empty, do not forget the curly brackets :
{
"auto_minify_on_save": true
}
This will work whether you save with Ctrl + s or from the menu.

How to set the working directory of WinGHCi

I just installed WinGHCi. When I try to load an .hs file with Ctrl+L, it opens the file browser in C:\Program Files (x86)\Haskell Platform\2012.2.0.0\winghci which is where I installed this. I don't want it to go there by default, I keep my code files in a different directory on a different drive and I don't want to have to navigate to D:\MyPath\Haskell every time I load a file.
I tried to set the "Start in" field of the shortcut I use to launch WinGHCi but it changed nothing.
How can I make WinGHCi look in my own directory by default?
It opens in the last directory you opened a .hs or .lhs from.
Try opening something from the folder you want, exit, restart.
Did it restart where you were?
Try working like that for a while, and if you like it (I do) then you're fine.
If you really do want to go to the same place every time, perhaps there's a way.
I can't find any setting to control this, but the information is stored in the registy.
Mine is at
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Haskell\WinGHCi 1.0.6]
"WorkingDir"="D:\\Files\\Andrew\\prog\\haskell"
You can save your version of that as resetghci.reg:
To make your own, open regedit and first try the same location. If not, search for WinGHCi.
You can export that subtree but you get the whole lot including recent expressions etc, which I don't think you should reset. Save that as ghcioriginal.reg just in case. Edit away all the lines except WorkingDir and save as resetghci.reg
When you double-click it it will ask you if you're sure you want to add that info to the registry. Yes you are.
Untested:
What follows works on older versions, but Microsoft seem to be going off .pif files and the start command, and I'm not able to test this in Windows 7.
Make a text file called ghci.bat in the same folder as the .reg you made. In it put
#echo off
regedit resetghci.reg
start WinGHCi
You might need to specify the full path to WinGHCi.
The start command is the windows equivalent of making a background process from a shell prompt, so this should terminate immediately.
Make a shortcut to ghci.bat (it will be called ghci.pif) and set it to open minimised and put a nice lambda icon on it (nick it from the winghci executable).
Pop that on your desktop, start menu or shortcut bar, and when you use it, you'll be popped back to your standard location.

I just can't figure out Project Plugin in VIM

I am trying to use VIM for some programming. I am a total beginner in VIM. Could you guys please help me figure out Project Plugin
I can't understand the documentation. If you have used this plugin, could you tell me the basic steps to get started?
In order to configure the project plugin, you must edit the .vimprojects file. An example is given in the help
:help project-example
As you will see, you have to write something like this
Name_of_project = path/to/your/project CD=. flags=flags_you_want{
file1
file2
...
Name_of_Subcategory = path/to/your/subcategory filter=files_you_want{
subcategory_file1
subcategory_file2
...
}
}
Now you can call your project:
:Project
This will open a vertical window with the file you've just configured. Click on any file you added to open it.
For the flags and the filter, everything is explained in the help file. There are others subtleties you'll have to discover by yourself.
I hope this will help you.
You can also have the plugin generate the file for you: invoke :Project in normal mode, and then hit \C which will prompt you for the name of the project, the directory of the project (i.e., ~/Projects/Foobar if ~/Projects/Foobar contains all your code, et cetera), the cd parameter (always the same as the directory, for me) and a standard file filter (*.cpp or what have you).
You can then write this projects file out with :w filename and load it later on.

Resources