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

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.

Related

Move files based on filename using command prompt

I am trying to move files from a location to another one based on filename ONLY by using command line. The below works pretty fine but I do not want to specify both, the file name and the extension:
MOVE C:\firstlocation\file.sdltm "C:\secondlocation\file.sdltm"
The reason behind this is that I have the following files in the firstlocation:
file.sdltm
file.tmx
and my aim is to move both files named "file" to the secondlocation regardless the extension.
Sorry if this question has been asked before, - couldn't find any that matches my criteria.

Bash script for editing multiple text files

I would like some guide and help for this:
I have a text file with names listed in it. I will call it “source file”
I have multiple text files scattered in folders and sub folders
I would like to know how to make a script that would automatically add SPECIFIC LINE to every text file (in subfolders of chosen target folder) that contains exact name listed in “source file”
More detailed/Example:
I have a names.txt that contains many names. I want to find all the text files in target folder and it’s subfolders that contains names listed in names.txt and in those files automatically add “FALSE” line (in front or after specific existing line).

sql loader without .dat extension

Oracle's sqlldr defaults to a .dat extension. That I want to override. I don't like to rename the file. When googled get to know few answers to use . like data='fileName.' which is not working. Share your ideas, please.
Error message is fileName.dat is not found.
Sqlloder has default extension for all input files data,log,control...
data= .dat
log= .log
control = .ctl
bad =.bad
PARFILE = .par
But you have to pass filename without apostrophe and dot
sqlloder pass/user#db control=control data=data
sqloader will add extension. control.ctl data.dat
Nevertheless i do not understand why you do not want to specify extension?
You can't, at least in Unix/Linux environments. In Windows you can use the trailing period trick, specifying either INFILE 'filename.' in the control file or DATA=filename. on the command line. WIndows file name handling allows that; you can for instance do DIR filename. at a command prompt and it will list the file with no extension (as will DIR filename). But you can't do that with *nix, from a shell prompt or anywhere else.
You said you don't want to copy or rename the file. Temporarily renaming it might be the simplest solution, but as you may have a reason not to do that even briefly you could instead create a hard or soft link to the file which does have an extension, and use that link as the target instead. You could wrap that in a shell script that takes the file name argument:
# set variable from correct positional parameter; if you pass in the control
# file name or other options, this might not be $1 so adjust as needed
# if the tmeproary file won't be int he same directory, need to be full path
filename=$1
# optionally check file exists, is readable, etc. but overkill for demo
# can also check temporary file does not already exist - stop or remove
# create soft link somewhere it won't impact any other processes
ln -s ${filename} /tmp/${filename##*/}.dat
# run SQL*Loader with soft link as target
sqlldr user/password#db control=file.ctl data=/tmp/${filename##*/}.dat
# clean up
rm -f /tmp/${filename##*/}.dat
You can then call that as:
./scriptfile.sh /path/to/filename
If you can create the link in the same directory then you only need to pass the file, but if it's somewhere else - which may be necessary depending on why renaming isn't an option, and desirable either way - then you need to pass the full path of the data file so the link works. (If the temporary file will be int he same filesystem you could use a hard link, and you wouldn't have to pass the full path then either, but it's still cleaner to do so).
As you haven't shown your current command line options you may have to adjust that to take into account anything else you currently specify there rather than in the control file, particularly which positional argument is actually the data file path.
I have the same issue. I get a monthly download of reference data used in medical application and the 485 downloaded files don't have file extensions (#2gb). Unless I can load without file extensions I have to copy the files with .dat and load from there.

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.

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