Sublime3 creating empty file Plain Text or Textfile? - sublimetext3

I Installed Sublime Text 3 and I'm trying to create an empty file ".txt", from the bottom right menu to choose "Plain Text" or "Textfile", I want to create an empty file writing normal text, which one is the correct to choose?

Sorry my bad the file type is called "textile" not "textfile", I think plain text is the correct answer.
Plain text, Plain-text, or Plaintext is any text, text file, or
document that contains only text. ... Most associate plain text files
with the file extension . txt on Microsoft Windows computers, however,
can be any non-formatted file. To view a plaintext file, a text editor
such as Microsoft Notepad is used.

Related

Edit contents of RTF file with Powershell - Hyperlink/Mailto

Trying to update a mailto value of an RTF document with a powershell script, but it seems that the issue is RTF file related rather than Powershell related because can't get it to work when doing it by hand either:
I have previously made small find and replace changes to RTF files by finding that bit of text and changing it within the file, not using any kind of RTF library or cmdlet but just using plain string processing. With more recent RTF files updating the mailto: value in the raw file text does not seem to update the address a new message is created addressed to, and the previous value is used for the new message's TO value. The previous value not appearing in the file in plain text at that point and yet being known once the mailto link is clicked.
I am aware that RTF files have changed over time and not all of the content is purely ASCII and formatting control markup and I presume that the mailto: target is held somewhere that's not plaintext. I need to know where this other instance of the data is held in the file and a way to edit it.
mailto still showing the old email that no longer appears in plaintext in file
mailto value updated in file
Thanks for any thoughts or suggestions for things to try next!
Kind regards,
Oscar
I am able to update html and txt files just fine, but more recently RTF files are seemingly not showing the updated values because somehow they are storing the hyperlink target in a second place in the file that is not human readable. Updating other elements just by changing the human-readable instances of them in the file seems to work fine, just not the hyperlink 'mailto:' section now. Updating the link in word processor causes the human-readable 'mailto:' section to be updated when viewed in a text editor, but updating the value in a text editor and then opening it in the word processor does not show the update. So it seems to be storing the value in multiple places and the plain text version is not used in the event they're different, in so far as I've established.
Perhaps there is an RTF cmdlet or library that lets you edit the binary portion (or whatever alternate location it's held in) of the RTF file, or it would be easier to create the RTF version of the file from the properly updated HTML version. Open to ideas!

extract location of a specified string in a pdf file

I'm not familiar with pdf rendering system or postscript, and I'd like to know if in principle - it would be possible to extract the location of a string in a pdf. that is:
given a pdf with regular text paragraphs (not form-fileds\text boxes or other objects, simple text)
search for a specific string in the file
get the x,y coordinates of that the first letter.
I've searched pdf-libs in many languages but they don't seem to allow such operation.
does pdf standard supports this?
The closest thing I could find involves finding the location of a text box
(see here)
Depending on your use case, this could help.
for instance, in my case, I wanted to replace a specified string with another string. A possible solution for me:
Include a text box in the original pdf (the author of the pdf can do that using adobe acrobat pro or equivalent)
Find the text box using code and extract it's location
remove the text box from the document and insert your text at the extracted position.

Corrupt Text File read/write/open

I have a large text file that I take notes in; Recently, after saving it, it won't open and gives following error. I tried a few things on web that didn't work---opening in different encoding format, etc. Nothing worked. Any idea how I can open it again? Is there a language I can use from bash? I'm very familiar with PHP. Any ideas? Different text editor?
Error:
"The document “ToDo.txt” could not be opened. Text encoding Unicode (UTF-8) isn’t applicable."
"The file may have been saved using a different text encoding, or it may not be a text file."
cat the file from the CLI and make sure your data is still there. Then you could simply copy and paste the output into a new file and hopefully get rid of whatever weird encodings are causing that text editor to not read the file.

Sublime search "Find in Files" doesn't always work

The EXACT same thing if i do it in .html , xml files e.t.c it works as it should. That is it reutrns a filled find results tab. In this file it doesn't
I have a simple .log text file
When i search with ctrl+f everything is ok:
when i use ctrl+shift+f i have 0 results. Why?
Scanning through the text of these log files, do you see any control characters? According to this answer to your question in the Sublime Text forum, when Sublime Text finds inline control characters, Find in Files will treat the whole file as binary and therefore not display detailed results.
TL;DR: Try deleting control characters.

I want to change the way text is represented internally in ANY Text Editor

I want to use a algorithm to reduce memory used to save the particular text file.I don't really know how text is stored but i have an idea in mind.
Would it be better to extend a open source text editor (if yes than which one) or write a text editor myself.
It would be nice if someone could also give me a link or tutorial to some basics on how text editors work and the way data is stored.
Edited to add
To clarify, what I wanted to do is instead of saving duplicates of a word make a hash table and store the address where it needs to be placed.
That way I wouldn't be storing the duplicates.
This would have become specific to a particular text editor.
Update
thanks everyone I got what all of you'll are trying to say. Anyways all i wanted to do is instead of saving duplicates of a word make a hash table and store the address where it needs to be placed.
This was i wouldn't be storing the duplicates.
Yes and this would have become specific to a particular text editor. never realized that.
I want to use a algorithm to reduce memory used to save the particular text file
If you did this you would no longer have a text editor, but instead you would have created some sort of binary file editor.
The whole point of the text file format is that it is universal, meaning any text file can be open in any other text editor.
Emacs handles compression transparently. Just create a text file with .gz extension. Emacs will automatically compress contents of the file during save operation, and decompress when you open the file next time.
Text is basically stored as-is. i.e., every character takes up a byte or two (wide chars), and there is no conversion done on it when it's saved. It might add an end-of-file character or something though. Don't try coming up with your own algorithm to compress these files. That's why zip-files and other archives were created. They're really good at compressing text. If you wanted to add these feature to your text-editor, you'd have to add some sort of post-save hook to zip it, and then put a hook on the open command to unzip it. Unless you wanted to do it by hand every time. Don't try writing the text editor yourself from scratch, unless (maybe) you're writing notepad. Text editors with syntax highlighting aren't very easy to make, even with the proper libraries. I'd say write a plugin for something like Visual Studio or what have you. Or find an open-source text editor.

Resources