how to change default settings in .minttyrc programmatically - bash

I want to increase the default font Lucida Console from 9pt to 12pt and adjust the blue color quality. Currently the only way I can find to do it is by right-clicking the Cygwin window and selecting Options & Text and Apply as described in this answer.
I tried to edit .minttyrc to change the font size and color as suggested here. Settings are shown below. But when I relaunch the Cygwin shortcut the default window reappears.
C:\cygwin64\home>cat .minttyrc
FontHeight=12
Blue=127,127,255
BoldBlue=191,191,255
Is there a way to set .minttyrc programmatically ? Surely there is a way to change the default settings without doing this manually every time.
EDIT.
I have Cygwin configured like this ( a screen shot of the window opened by the DOS batch file).
Here is the code suggested by me_and
C:\cygwin64\home\Greg\Work\CMI>cat ~/.minttyrc
cat: '~/.minttyrc': No such file or directory
I can get .bashrc to find .CMI_functions in a sub-directory but I don't know how to get it to find .minttyrc in the same directory
CONCLUSION.
Best results came from editing the Cygwin batch file to relocate all .executable bash files, together with .minttyrc, into C:\cygwin64\home\%USERNAME%.
cd %USERPROFILE%\Desktop\Archive\UTIL
xcopy . C:\cygwin64\home\%USERNAME%\Work\CMI\UTIL /E /I
copy Misc\* C:\cygwin64\home\%USERNAME%\Work\CMI
copy Bash\.* C:\cygwin64\home\%USERNAME%
copy Scripts\*.sh C:\cygwin64\home\%USERNAME%\Work\CMI

The Super User question you've linked to talks about putting the .minttyrc file as ~/.minttyrc, which as a Windows path (at least with default settings) would be something like C:\cygwin64\home\Greg\.minttyrc, but you have it as C:\cygwin64\home\.minttyrc. That's the wrong place, so it's never going to work.
To change the settings for Mintty, you need to have the file in the right location, otherwise it won't be able to load them. Try moving the file to the correct location, and see if that resolves things for you.

Related

.srt file types doesn't exist under 'Choose default apps by file type' after after formatting windows 10, what to do?

Before I did a clean install of my desktop with windows 10 I had .srt to open by default in Sublime Text after I have formatted my computer I somehow miss the file format .srt under 'Choose default apps by file type'.
The .srt should be be between the .srf and .srw file types, but it isn't (as shown in the image here: https://answers.microsoft.com/en-us/windows/forum/windows_10-desktop-winpc/srt-files-back-to-unknown-application/e33cace8-dd59-4557-9631-e8e82a8307b3?auth=1).
If I try "open with and find Sublime (or any other software for that matter, it will open it, but it will not set it as the default program even though I checked the box) and will still appear as an unknown filetype....
If I go into properties and try to change the "open with" from there, it will just keep showing "choose a program" even still.
tried updating the computer and restart it and frankly I've given up, and it doesn't seem anyone have run into this problem before of missing a filetype under 'Choose default apps by file type'.
I also tried
1) Settings - Indexing Options
2) Advanced button
3) File Types tab
4) Add New Extension to List box, type in extension (without a period) such as "py"
5) Click Add, OK and Close
and while the format does appear in the 'Choose default apps by file type', it still doesn't let me change it at all...
Anyone got an answer to this problem?
I have now tried to go into regedit and use "search" on anything that included "sublime" and ".srt" and deleted them all... restarted the computer, reinstall sublime. The file extension I created myself in the indexing option, has been deleted.
Sublime can still open the file, but if you try to make it default program by simply opening it or or going into the files properties and do it that way, it will just open the file without it making it the default program as it should.
going into the indexing option and create the .srt extension format so it can be found under 'Choose default apps by file type' will allow you to choose notepad or wordpad as default program. When I choose either of them, the will just freeze for 1-2 sec and then nothing has changed and the extension havn't been associated with any of the programs.
I tried following the following links, and nothing has worked. Guess I'll just have to accept there is no solution rather than to live with out until I reform my PC again, cause it works without a problem on my laptop and I formatted them both the same time and installed the exact same things on both and the exact same way s:
I've tried to use the following links for help, but to no avail since non of the things I have tried have fixed it.
https://superuser.com/questions/655600/i-cant-set-a-program-as-the-default-to-open-a-filetype-with-in-windows-7
https://superuser.com/questions/91655/open-with-dialog-ignores-my-selection
https://superuser.com/questions/13653/how-to-set-the-default-program-for-opening-files-without-an-extension-in-windows
Windows 7 file extension association
One way to get an empty .srt entry back in the 'Choose default apps by file type' control panel is to create a new key for .srt in your registry under HKEY_CLASSES_ROOT:
Open Registry Editor, e.g. by typing 'regedit' into the start menu or a command prompt
At the top of the tree, right-click on 'HKEY_CLASSES_ROOT', New -> Key
Rename the new key to '.srt' and press enter to save

Cannot make folder read only

Here is what happens when I make the folder read only:
It asks for admin access to it and I click ok.
But when I go back and check it again it has reverted back to read only.
the reason I am doing this is I need to be able to make a new file in the folder via cmd.
Thanks, I am using windows 7
Folders don't show their read only status in Explorer. This is by design as users will screw things up by removing read only on Windows special folders.
The file system ignores it except it resists deletion. However programs can change the attribute and then delete it, and this is what Windows Explorer does.
As the read only attribute is unused for folders (except as noted above) Windows Explorer uses it (or the system attribute) to mark a folder as special. When opening a folder for viewing it uses the presence of the read only attribute to tell it to use a different viewer from the standard folder viewer. Like the fonts folder - instead of showing files it shows installed fonts. This use is specific to Windows Explorer and there is no support to other programs for it.
As Windows Explorer doesn't want you changing the flag it uses it doesn't show if a folder is marked read only or not. It shows indeterminate. If you click the box it will change between ticked, unticked, and indeterminate. Clicking the box and changing it, it will apply to files in the folder not the folder.
Attrib shows the attributes of a folder
attrib "%userprofile%\documents"
And you can see even though read only is set you can save files to your Documents folder.
Attrib can only change an attribute if the file doesn't have hidden or system attribute also set. To change it on these you must change all three to off.
attrib -r -s -h "%userprofile%\documents"
For Help on attrib type
attrib /?

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.

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.

Setting the Search Path... global setting in MacVim

Noticed an interesting GUI based setting in MacVim, that seems useful but I can't seem to find any official word on what it does exactly.
It is located at Edit Menu > Global Settings > Search Path...
Once there a dialog drops down with the following:
"Enter search path for files"
Separate directory names with a comma.
.,/usr/include,,
From that editable line I get the clue that this appears to be a header search path. Something I would hope works with ctags, etc. But the setting I put in there don't seem to stick between open and closing just MacVim windows with out even quitting the MacVim Application.
Searing Vim help only really turns up new-search-path which I am not sure how to use or set if it is even related?
Is this what I think it is? The header search path. If yes then how do I set the path in my .vimrc or where needed so that the changes to it are persistent.
If this is not a header search path then what does it do?
I think you are right about its purpose, the setting is simply called path: its default value (:set path?) is .,/usr/include,, just as in your question.
You can use it to tell Vim to look for files in specific places.

Resources