change line endings in sublime - sublimetext2

how could I change line endings to sublime default in existing file?
there is no problem with line endings when creating new files in sublime (default line endings property works well)

You can see and convert line endings in:
View -> Line Endings

Related

Swig output line endings

I'm running swig using cmake to interface some c++ libraries with java. Was wondering if there was an option to specify the line endings of the java output files generated by swig?
set(swig_interface "swig/my_swig.i")
set_source_files_properties("${swig_interface}" PROPERTIES CPLUSPLUS ON)
set(jni_output "${SWIG_WRAPPER_OUTPUT}/com/domain/group")
# Hoping theres a flag I can add here which will set the line endings
set(CMAKE_SWIG_FLAGS "-package" "com.domain.group"
"-I${CMAKE_CURRENT_SOURCE_DIR}/include")
set(CMAKE_SWIG_OUTDIR "${jni_output}")
swig_add_module(jni_wrapper java "${swig_interface}" ${lib_src_files})
swig_link_libraries(jni_wrapper other_lib)

Sublime Text 3 Default File Type on new file

I was looking around and the questions and answers did not seem to match what I am looking for (Sublime Text 3). Anytime I open a new file it defaults to a plain text file. I mostly work with PHP files so I was wondering if there is a setting that would be changed so that when I open a new file it will default to PHP.
I tried to find this directory path "Packages/Text/Plain_text.tmLanguage" here:
C:\Program Files\Sublime Text 3\Packages
C:\Users\user\AppData\Roaming\Sublime Text 3\Packages
But I did not find the "tmLanguage" files.
Reference: Sublime Text 2 - Default Document Type
The .tmLanguage files are within the .sublime-package files which are secretly simple archives holding all files necessary for a package to work.
Add a .zip extension to the .sublime-package file that contains the PHP settings and you can extract the .tmLanguage file you want as your new default.
Once you have that file, follow the instructions from the question you linked to and you should be good to go.
Set default file type in Sublime Text
Rather than messing with the files in your OS and adding a .zip extension to one of them …
… if you want to find the directory path to a built-in .sublime-syntax or a .tmLanguage file install PacakgeResourceViewer from Package Control.
After installing, use command palette to Package Resource Viewer: Open Resource and find PHP.sublime-syntax.
You can then see the path is Packages/PHP/PHP.sublime-syntax.
then:
Install DefaultFileType and edit its configuration file: Packages/User/default_file_type.sublime-settings as follows:
{ "default_new_file_syntax": "Packages/PHP/PHP.sublime-syntax",
"use_current_file_syntax": false }
Now your new files will default to sublime's built-in PHP syntax highlighting.

CSV File showing random characteristics

I copied a file from my ipad using iFunBox and I tried opened it with:
Microsoft Excel
FreeFileViewer
Notepad
Notepad++
All of them shown nothing File (.csv) Everytime open it using those 4 programmes this is what I get:
] 1 ˆ&ÓMF.¶•J¡ ñßR)åÙ¥e
ò¦Øœsl\V{`¸u°N±vI¦½™êk4“‡-m Ùò¾ˆÚär'²ø¢å:š nàÊ#‹8yH#uä³éc‹übuÙÀÙHIˆ[g¿^¶$9¹asï³`‰;*ý:Ôê]ÓlÆFJŠzÆy l[
†nÒdzÙ› ™uê^ï:—ŽœÏ·`ð€‡°XR…Hù™6è³ß×+¥Û/‹ÐÉÞ‡çååw¿öùr~uóçˆKÝcýœó©û$R0áÓ)`´Á°ŠOŸ¸hÉw”ÕÌ$¾S|åÚ†G¾Ùú¿#/¯J(Ádž‡Úøo䇙ñyŠÃ©A°6ÀÊ¿©þFDBº·SáóDEa±€o¹Nê¦ä~iÿñÍQ‹òÊun¢ç,Æâðe IéŒ
The file seems to be binary and not CSV. CSV is a plain text file which depending on the text encoding may show some strange characters, but mainly plainly readable. The file above is a kind of OMF file, whatever that is.

Unicode decode error in YUI Compressor plugin for Sublime Text 2

I can't seem to get the Yui Compressor plugin for Sublime Text 2 working, and keep getting the error like:
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9e in position 19: ordinal not in range(128)
Writing file /C/Users/Nikola Brežnjak/Desktop/yuicompressor-2.4.7/build/justTesting.js with encoding UTF-8
Running java -jar C:\Users\Nikola Brežnjak\AppData\Roaming\Sublime Text 2\Packages\YUI Compressor\bin\yuicompressor-2.4.7.jar --charset utf-8 --preserve-semi --line-break 150 -o justTesting.min.js C:\Users\Nikola Brežnjak\Desktop\yuicompressor-2.4.7\build\justTesting.js
Traceback (most recent call last):
File ".\sublime_plugin.py", line 337, in run_
File ".\exec.py", line 154, in run
File ".\exec.py", line 45, in __init__
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9e in position 19: ordinal not in range(128)
I installed the plugin via package manager and I made sure I've put java in my PATH variable and if I run it via the console the YUI Compressor does its job.
The issue was with the path in which my Sublime Text is installed - notice the ž character in my surname.
So, after a lot of searching I found out the solution here, and as stated there it seems to be the error within the exec.py file, which can be found in your Sublime Packages directory (for example: C:\Users\Nikola Brežnjak\AppData\Roaming\Sublime Text 2\Packages\Default). You have to change the line 45 from:
proc_env[k] = os.path.expandvars(v).encode(sys.getfilesystemencoding())
to:
proc_env[k] = os.path.expandvars(v.decode(sys.getfilesystemencoding())).encode(sys.getfilesystemencoding())
After this you have to save the file, and the plugin will reload automatically, and then the YUI compressor plugin will work flawlessly.

Sublime Text 2: Setting file syntax inside the file itself (as Vim modelines)

In VIM one can force a file type by writing a modeline like this
# vim:syntax=html filetype=html
I'ld like to obtain the same thing for Sublime Text. For example I'ld like Sublime Text 2 to use MarkDown syntax for some file I have with .txt extension.
There is a Modelines plugin for Sublime Text: https://github.com/SublimeText/Modelines
To do this for every file with a specific extension, with a file open go to menu View, Syntax, Open all with current extension as... and set your preference there.
It doesn't seem to be possible natively to set it per file or project, but propably you should take a look at this package: https://github.com/phillipkoebbe/DetectSyntax
Another one available in package control for ST2/3 is https://github.com/kvs/STEmacsModelines
using it is very simple, from the docs:
Somewhere within the first five lines of a file, add a line matching the following:
-*- key: value; key2: value2 -*-
or
-*- syntax -*-