How do you remove an xdg-mime default association? - x11

So xdgmime default foo.desktop application/x-foo will associate a mime type in ~/.local/share/applications/mimeapps.list like this:
[Default Applications]
...
application/x-foo=foo.desktop
What is the "proper" way to remove the association?
I just edited the file with vim, deleted the line, and it worked, but xdg-mime has install/uninstall for other purposes so is there a "right" way to remove the default?

Related

Sublime Text - spell check does not work for .txt files (while working for other files)

Sublime Text - spell check does not work for .txt files (while working for other files).
Why? How to fix? Any ideas?
Also: in a new file (not yet saved) the spell check works. However, after the file is saved as .txt, the spell check does not work. Unexpected. Why? How to fix?
The Preferences.sublime-settings has:
"spell_check": true,
and nothing special for .txt files.
Sublime Text, Build 4126.
UPD. In safe mode:
Here we see that in helloe.bash the helloe is not spell-checked. Why?
The Bash.sublime-settings has:
// These settings override both User and Default settings for the Bash syntax
{
}
UPD2. After adding "spell_check": true in Bash.sublime-settings the helloe is still not spell-checked. Any ideas why?
Multiple things to check:
Check how .txt files are syntax-highlighted. In my case .txt files are syntax-highlighted as .bash files (it is needed by some reason).
If .txt files are syntax-highlighted as .bash files, then helloe is a variable name, which is not spell checked by default. As user #OdatNurd said:
spell_check controls weather or not spell checking is turned on or not, but spelling_selector determines what text is actually spell checked. Specifically, in source code files it's basically strings and comments. In your example the text is a variable name. If you want to alter that, you need to alter the spelling_selector too.

Sublime Text 2 - Default Document Type

Is there a way to set a default document type when saving a NEW FILE?
I created several new files and I want to have a default value of .txt when saving a NEW FILE.
Create a new plugin Tools > Developer > New Plugin...
Paste this in:
import sublime, sublime_plugin
class EverythingIsPowerShell(sublime_plugin.EventListener):
def on_new(self, view):
view.set_syntax_file('Packages/PowerShell/Support/PowershellSyntax.tmLanguage')
Save and call it NewTabSyntax.py. New tabs will now default to Powershell.
You can change the syntax to whatever you prefer. To find out the "path" of a particular syntax, simply open a file of that syntax, open the console (View > Show Console) and type:
view.settings().get('syntax')
This plugin does it:
https://github.com/spadgos/sublime-DefaultFileType
seems pretty great.
Edit:
Ok, two things, there currently seems to be a small bug so the text file syntax is not being correctly picked up due to the whitespace in the filename. In addition you need to set the "use_current_file_syntax" to false, (otherwise the new file will default to whatever filetype you have open already when you hit Ctrl-N)... So the fix/workaround is this:
Put the following code in: Packages/User/default_file_type.sublime-settings
{ "default_new_file_syntax": "Packages/Text/Plain_text.tmLanguage",
"use_current_file_syntax": false }
NOTE THE UNDERSCORE.
Next, find the "Plain text.tmLanguage" file and copy and rename it (in the same folder) as "Plain_text.tmLanguage". [be sure to copy/duplicate it, do not just rename it, as it may have dependancies]
Restart, just to be sure, and this should do the trick.
Also note this plugin only works for new files created with Ctrl-N.
Working after these steps:
1.Uninstalled
2.Installed using Package Control
3.Test using default install (type Jave) <-- worked
4.Copy and Renamed file Sublime Text 2\Packages\Text\Plain text.tmLanguage > Sublime Text 2\Packages\Text\Plain_text.tmLanguage
5.Changed file Sublime Text 2\Packages\Default File Type\default_file_type.sublime-settings >
`{ "default_new_file_syntax": "Packages/Text/Plain_text.tmLanguage", "use_current_file_syntax": true }`
-- All working.
I did not need to copy any files into the 'Packages/User' folder
#fraxel _ Thanks for all the help and quick response.

How to change comment syntax in Geany

In Geany, editing PHP scripts, when you select lines and press control-e, the selected lines are commented by being wrapped in "/* ... */". Is there a way to change this behaviour so that it instead puts a "//" in front of each line?
All the other IDEs that I've used make use of "//" (Eclipse, Netbeans, Textmate, etc).
Settings like comment characters are controlled by filetype definition files. Assuming your scripts end in .php, you should find the default system-wide filetype definition file filetypes.php, and copy it to your filedefs directory in your user configuration directory. Then you can modify it as necessary.
This is all explained in detail in the manual (link above).

How do I specify that I want Vim to treat .ru files like .rb files

Whenever I use Vim with Ruby files, I get nice coloring and automatic indention on blocks. However, when I am editing a Rack file, I don't get these things. How can I extend my Vim/Ruby configuration with my Rack files?
Put this in your vimrc to tell vim to associate *.ru files with ruby syntax highlighting.
au BufRead,BufNewFile *.ru setfiletype ruby
Ensure the following lines are in your vimrc file:
syntax on
filetype on
au BufNewFile,BufRead *.ru set filetype=ruby
The first two are probably already set if other files are syntax-colored, but I've put them there anyway.
The final one sets automatic actions on creating a new file and opening an existing file, to set the file type based on the extension.
You can install the vim-ruby plugin by tpope, which will do this and much more!

do not include required files into vim omnicompletion

If I try to autocomplete smth in a Ruby file, that has require 'xxx' statement, it starts to scan all files required (and files required by required files as well). and it does that every freakin time!
Is it possible to make vim autocomplete to NOT scan required files or just files in particular path (e.g. app/ only)?
One of the following should work
:set path=.,/myinclude1,/myinclude2 to set your own include path
:set complete-=i to disable use of included files in default completion
:set include= to unset the include file matching pattern
I would suggest you use the second one, so CTRL-X CTRL-I will still work correctly

Resources