Can I set the VS Code default EOL based on file type? - visual-studio-code

Working with .sh files on Windows causes issues when running them in Linux Docker containers if they have EOL of CRLF. Can I make VS Code always work with LF for specific file type such as .sh while still using CRLF for all others?
I only find "files.eol": "\r\n" in settings, but this is global.
I understand you can change this in the bottom toolbar on a per-file basis, but I would like this to be the default for all .sh files.

In your settings window, go to
Settings > Text Editor > Files > Eol option. You'll fine following available options there
- \n
- \r\n
- auto (default)
Here \n represents LF, \r\n represents CRLF, and auto use the operating system specific EL operator.
Select your option and save.
VS Code: version 1.13.3

You can use EditorConfig.
Install the editorconfig extension, and then add a .editorconfig file at the root of your project with this:
[*]
end_of_line = crlf
[*.{sh}]
end_of_line = lf
But as #axiac said, I would recommend to always use lf...

EDIT : I was a bit "premature" with this answer. But it now works as of v1.40. See https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_40.md#fileseol-per-language
You can do this in vscode without an extension. You can make a language-specific setting:
In the command palette, search for "Configure language specific", select it and choose "shellscript" from the language options:
This will create the following in your settings:
"[shellscript]": {
},
Now add in whatever you want to apply to shellscript files only like (not all settings will work in there but most do):
"[shellscript]": {
"files.eol": "\n"
},
VERY, VERY IMPORTANT:
The end-of-line sequence is used for new files. For existing files,
the existing end-of-line sequence is always preserved. To change the
end-of-line sequence for an existing file, use the Change End Of Line
Sequence command.
from https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_40.md#fileseol-per-language

Related

How to remove black left line in neovim

When I open a python file, in the left hand side, there is an extra space as shown in the images, and this is only with python and the init.vim files.
With a python file
With other language
For Python filetype, a configuration file should probably define Vim option signcolumn with value = 1.
Load a Python file and check what is the value for signcolumn option with :set signcolumn? command.
You could disable this option in your configuration file (see :help signcolumn) :
With Vimscript init.vim : set signcolumn=no
With Lua init.lua : vim.opt.signcolumn = 'no'

How to remove ansi code from output piped to VSCode?

As of November 2017 VSCode allow to pipe output directly to VSCode. I did tried with a few command until I got a bunch of ANSI codes which I'm not interested.
I'm running something like yarn info babel-core | code and getting this:
yarn info v0.24.6
{ name: [32m'babel-core'[39m,
description: [32m'A placeholder package that bridges babel-core to #babel/core.'[39m,
[32m'dist-tags'[39m:
{ latest: [32m'6.26.0'[39m,
old: [32m'5.8.38'[39m,
next: [32m'7.0.0-beta.3'[39m,
bridge: [32m'7.0.0-bridge.0'[39m },
I would like to that output without these ANSI codes.
If you NodeJS then you can globally install strip-ansi-cli which provides you the command: strip-ansi. It does exactly that.
For your case, you may use it as follow:
yarn info babel-core | strip-ansi | code
Happy coding!
Alternatively, plugins now exist, e.g. ANSI Colors, that once installed enable you to select ANSI text as the file's "language mode." You can then use VS Code's _Command Palette_ (Ctl-Sft-P) to preview the file (ANSI Text: Open Preview) with escape sequences respected, i.e. in color (and etc.)
Credit
Can I display a file with ANSI color escape sequences in Visual Studio Code?

Cannot open iReports 6

i tried installing the latest version of iReport. installation was successful but now while opening it is giving me error. the Slash screen opens and closes.
error :
my config file :
# ${HOME} will be replaced by user home directory according to platform
default_userdir="${HOME}/.${APPNAME}/5.6.0"
default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}/5.6.0"
# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="-J-Xms256m -J-Xmx512m -J-Dorg.netbeans.ProxyClassLoader.level=1000 -J-XX:MaxPermSize=512m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dnetbeans.exception.report.min.level=99999 "
# for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea
# default location of JDK/JRE, can be overridden by using --jdkhome <dir> switch
#jdkhome="C:\Program Files (x86)\Java"
jdkhome="\jdk1.6.0_45"
# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)
#extra_clusters=
please help me
Look at this line
# default location of JDK/JRE, can be overridden by using --jdkhome <dir> switch
#jdkhome="C:\Program Files (x86)\Java"
jdkhome="\jdk1.6.0_45"
# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)
#extra_clusters=
What you need is to set an environement varialble JDK_HOME that points to the path of your JDK installation , or update your config file to point to the path where JDK installed
a) Once installed, go to its \etc folder, e.g., C:\Program Files (x86)\Jaspersoft\iReport-5.6.0\etc and add write permissions (for yourself) to the readonly file ireport.conf, of which you show an example output.
b) Open ireport.conf w/ an editor like Notepad++ , and add the line for your jdk home, e.g., jdkhome="C:\\Program Files\\Java\\jdk1.7.0_71" (instead of just jdkhome="\jdk1.6.0_45"). Note: on Win OS you might need to use the escaped backslash.

How to use vim LatexSuite with a Makefile?

I would like to type :make in Vim to compile my LaTeX document. I wrote down compilation rules in a Makefile, but as soon as I enable the LatexSuite Vim extension, the Makefile is no longer used. Instead, Vim runs latex -interaction=nonstopmode (note the absence of a filename) and hangs in that command. I did not change the g:Tex_UseMakefile option from its default 1 to 0 and according to the documentation, that should cause my Makefile to be used, but it's not.
What configuration is needed to tell LatexSuite to just use my Makefile?
LatexSuite was obtained via OpenSuSE repositories: vim-plugin-latex-20120125-21.1.1.noarch
You can override this via following setting in your vimrc.
autocmd FileType tex let g:Tex_CompileRule_dvi = 'make'
Alternatively, set makeprg in $HOME/.vim/after/ftplugin/tex.vim
set makeprg='make'
Helpful in-source documentation of file <latex-suite-root-folder>/compiler/tex.vim
Section " Customization of 'makeprg': {{{
This (g:Tex_CompileRule_dvi) is a string which should be directly be able to be cast into
" &makeprg.

VIM: FileType specific mapping not working when defined in ftplugin

I am trying to set a mapping for FileType perl. The mapping is for the case when I forgot to use semicolon at the end of the line.
So first I tried adding in my .vimrc autocmd! FileType perl nnoremap <leader>; $a;<esc> and it worked fine but than I thought of using ftlugin/perl.vim .
So I added the below line in my corresponding ~/.vim/after/ftplugin/perl.vim
nnoremap <buffer> <leader>; $a;<esc>
but it didn't work.
Any idea why it is not working ?
My perl version is perl 5, version 14.
Try putting the file in ~/.vim/ftplugin/perl.vim instead of ~/.vim/after/ftplugin/perl.vim. From :help after-directory:
*after-directory*
4. In the "after" directory in the system-wide Vim directory. This is
for the system administrator to overrule or add to the distributed
defaults (rarely needed)
5. In the "after" directory in your home directory. This is for
personal preferences to overrule or add to the distributed defaults
or system-wide settings (rarely needed).
From :help ftplugin:
If you do want to use the default plugin, but overrule one of the settings,
you can write the different setting in a script: >
setlocal textwidth=70
Now write this in the "after" directory, so that it gets sourced after the
distributed "vim.vim" ftplugin |after-directory|. For Unix this would be
"~/.vim/after/ftplugin/vim.vim". Note that the default plugin will have set
"b:did_ftplugin", but it is ignored here.
One thing I just noticed that was driving me crazy: <buffer> must be lowercase! Out of habit, I uppercase all of my <BRACKET> prefixes... and I had done the same for <BUFFER>. None of my ftplugin mappings worked and I couldn't figure it out... until I wasted hours trying different things, only to find that it must be lowercase <buffer>.