Windows: text file became binary - windows

I am working on a QML project with Qt Creator 4.0.0 on Windows 10.
At one point I had a blue screen, and after rebooting, the file on which I was working became binary: impossible to open it on a text editor (including vim) or to see its text content.
I tried to change the file extension, to change the encoding in Sublime Text... nothing helped.
When asking for a git diff:
$ git diff qml/file.qml
Binary files a/qml/file.qml and b/qml/file.qml differ
Does anybody have any idea about how to retrieve the file?

Related

Vim Devicons Icon glitch on MacVim and Terminal Vim

As I was setting up my ~/.vimrc, I installed Plugin 'ryanoasis/vim-devicons' (https://github.com/ryanoasis/vim-devicons) and Plugin 'preservim/nerdtree' (https://github.com/preservim/nerdtree) - I ran into a problem. I couldn't see the desired Python file icons for any of my Python (.py) files in Nerd Tree window in Terminal Vim and Mac Vim.
The solution to this problem is rather simple as someone did figured it out already. (https://github.com/ryanoasis/vim-devicons/issues/198)
I am sharing this information on StackOverflow community for a quicker reference.
For seeing the file type specific icons in a File browser like Nerd Tree in Vim,
first please install - NERD FONT
(https://github.com/ryanoasis/nerd-fonts#font-installation)
by using the command:
brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
Final step -
For Terminal Vim: (Mac OS)
Change Terminal font to Hack Nerd Font
For Mac Vim: (GUI Vim)
Add this line to your vimrc file -
set guifont=hack_nerd_font:h21
(h21 sets the font size - change it any value based on your preference)
(save the changes to the vimrc file with command :wq)

ttf2ufm_x2gs on Ubuntu 20.04

I use national delivery service windows software for genarating and printing labels installed with Wine. The program works fine, but when I try to print the document printer uses different fonts for barcode. They provided 4 different ttf fonts with program to install it on system. I've installed them on wine and now they are OK in program. But problem comes when I try to print the files with printer or with cups-pdf the result is that the bar code looks completly different. I found out that I should install those fonts to ghostscript which transforms, but there is a problem. When I try to install font using ttf2ufm_x2gs which should install font to ghostscript I get following error code in terminal:
/usr/bin/ttf2ufm_x2gs: 82: .: 3:To many files open
I copied default config.cfg to folder with fonts. Only change that I've made is added ENCDIR and MAPDIR paths.
The Windows software must not be embedding the fonts into the ps/pdf as needed. The Xserver might be using the fonts correctly to display the result yet ghostscript can't embed the fonts needed for printing. The TTF fonts have probably not been added to a Fontmap file in the ghostscript library path or fontpath as required. The ttf2ufm_x2gs looks very complicated just for setting up fonts to be used by ghostscript. I suspect your fonts and Fontmap are still not working with ghostscript as needed. I don't use CUPS so can't help with that. The CUPS probably runs ghostscript to send the job to the printer and ghostscript can't find the TTF fonts.
I use the /usr/share/ghostscript/fonts/ directory for my own fonts to keep them separate from the dist packages so they won't be disturbed by package updates. Then the /usr/share/ghostscript/fonts/Fontmap file can be edited to tell ghostscript how to locate your needed TTF files. Be sure the Fontname is correct because that is difficult to discover with TTF files. The fontforge program can give the correct Fontname if unknown.
The Fontmap result should have the 4 TTF fonts listed, for example:
% font in same directory
/Fontname1 (font1.ttf) ;
% font in different directory
/Fontname2 (/path/to/font2.ttf) ;
% alternate style
(Fontname3) (font3.ttf) ;
% alternate style in different directory
(Fontname4) (/path/to/font4.ttf) ;

How to get Mac OSX Finder to preview programming text files that don't have .txt or .text extension?

Programming obviously involves lots of text file usage. You often want to see what you did somewhere else in some other program, without loading up that whole program into your current IDE of choice.
If I copy a text file from say fred.cpp to fred.cpp.text, I can view the contents of the file from the Finder's preview. But I don't want to have copy or rename all my development files.
In a 2003 (!) post on MacOSHints, there is an instruction to do this
find . -name *.xml -exec SetFile -t TEXT {} ;
(in that case, for *.xml files), but this didn't work for me due to issues with the exec command. But in any case, surely there's a better way to do it from the GUI?
Either way though: a command-line or a GUI solution would be great, thanks!
Update: I didn't manage to get qlcolorcode to work properly on the latest MacOS (10.15+) so I switched to this one.
https://github.com/sbarex/SourceCodeSyntaxHighlight
which can be installed with
brew install --cask --no-quarantine syntax-highlight
Original answer below
2 years late but you can use
https://github.com/anthonygelibert/QLColorCode
install via brew cask
brew cask install qlcolorcode
or
brew install --cask qlcolorcode
(if you have a newer brew.)
for more nice usages of the quicklook, check this repo
https://github.com/sindresorhus/quick-look-plugins
There is the Textmate QuickLook plugin which only works with Textmate running.
Pro: Syntax Highlighting
Contra: Only with (non-free) Textmate running
Alternatively: QLStephen
QLStephen is an Apple OSX QuickLook plugin that lets you view plain text files without a file extension.
But it works for all plain text files (even with extension).
Pro: Stable and free
Contra: No syntax highlighting

Sublime Text 3 Change Syntax Coloring?

I recently installed Sublime 3, and it's a really neat program, but I haven't been able to find out how to change the colors of the syntax(i.e. block comments, etc)
I've opened Default.sublime-package in Notepad++, and I've found the "Monokai" section(the color scheme I'm using), but even if I change the colors for comments, or even the background, when I open Sublime 3, the colors aren't what I changed them to. I've looked at similar questions on Stack Overflow, but the solutions posted didn't work, and I haven't been able to find anything on Google either.
How can I change the coloring of the syntax, background, etc in Sublime 3?
Use Sublime themes. Monokai is a default theme. You can download any theme you want (for example, from this site: http://devthemez.com/themes/sublime-text-2) and install it. Sublime Text 2 themes mostly work for version 3 either.
First, install Package Control. Instructions: https://sublime.wbond.net/installation. It is simple:
press Ctrl+`
paste provided string and press Enter.
Then clone repository with the theme you want (you need to have some version control system installed, usually it is Git).
In terminal:
Linux: cd ~/.config/sublime-text-3/Packages
Mac: cd ~/Library/Application Support/Sublime Text 3/Packages
Windows: cd %appdata%\Sublime Text 3\Packages
If repository is in GitHub, use git: (example with Argonaut theme from devthemez.com, link is provided below)
git clone git://github.com/pwaleczek/Argonaut.git 'Theme - Argonaut'
Then final step:
In Sublime, open Preferences -> Settings-User and paste appropriate code provided by theme developer: (again, example for Argonaut theme)
{
"theme": "Argonaut.sublime-theme",
"color_scheme": "Packages/Theme - Argonaut/Argonaut.tmTheme"
}
Examples were for Argonaut theme: https://github.com/pwaleczek/Argonaut (this page also contain some sort of instructions for installation).

Adding Sublime Text back to gitbash command line

I'm new to programming and bash scripts, so this might be an easy question.
A while back, I installed Sublime Text 2 and did something with my system's Path, so that whenever I type
$ sublime_text file.py
it would either open or create file.py in the current folder with Sublime.
However, if I do that now, I get an error message that "This build of Sublime has expired."
Any ideas on what I need to do now?
Thanks!
You may be using a beta build of Sublime Text 2. Update your application and make sure you have the latest version by downloading the latest build from here

Resources