My macvim cannot display chinese character properly and it showed me a ? in square.
I try to put this set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 in my .vimrc file but the problem is not solved.
This is my .vimrc file.
set encoding=utf-8
set rtp+=~/.vim/bundle/neobundle.vim/
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
set guifont=Monaco:h15
colorscheme Tomorrow-Night-Eighties
runtime! custom_preconfig/*.vim
runtime! common_config/*.vim
runtime! custom_config/*.vim
" for git, add spell checking and automatic wrapping at 80 columns
autocmd Filetype gitcommit setlocal spell textwidth=80
map <F1> <Esc>
" auto complete special keyword such as _ and - for css and scss 48-57 means
" unicode character
autocmd FileType css,scss,coffee set iskeyword=#,48-57,_,-,?,!,192-255
" autosave on focus lost
:au FocusLost * silent! wa
Related
When I open my init.vim, I'm met with this error message repeated many times
E79: Cannot expand wildcards
My neovim config file is stored: ~/.config/nvim/init.vim
And vim does not respond to my plugin commands,which have been installed via a plugin manager.
:help e79 returns:
Cannot expand wildcards
A filename contains a strange combination of characters, which causes Vim to
attempt expanding wildcards but this fails. This does NOT mean that no
matching file names could be found, but that the pattern was illegal.
The current contents of my init.vim:
set number
set scrolloff=16
set relativenumber
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
colorscheme koehler
au TextYankPost * silent! lua vim.highlight.on_yank {higroup="IncSearch", timeout=500}
call plug#begin('~./config/nvim/plugged')
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
call plug#end()
let mapleader = " "
nnoremap <leader><CR> :so ~/.config/nvim/init.vim<CR>
vnoremap <leader>yy "+y
nnoremap <leader>pf :Files<CR>
Error messages when using plugin keywords:
E492: Not an editor command: Files
So I am trying to set up my vimrc for python and web development. This is what my vimrc looks like.
"--------------vundle------------------------
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"add plugins here
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-surround'
Plugin 'itchyny/lightline.vim'
call vundle#end()
filetype plugin indent on
"------------------end of vundle-------------------
"--------------python development-----------------
"PEP8 python indentation and formatting
au BufNewFile,BufREad *.py
\ set tabstop=4
\ set softtabstop=4
\ set shiftwidth=4
\ set textwidth=79
\ set expandtab
\ set autoindent
\set fileformat=unix
let python_highlight_all=1
syntax on
"---------------web development------------------
"basic tab spacing for html, css and js
au BufNewFile,BufRead *.js, *.html, *.css
\ set tabstop=2
\set softtabstop=2
\set shiftwidth=2
However when I open or create an html file it indents 8 spaces rather than 2. What am I missing?
Thanks!
You can check where the indent options were set via
:verbose setlocal ts? sts? sw? et?
I believe in your case, the problem is with the list of patterns in your :autocmd:
au BufNewFile,BufRead *.js, *.html, *.css
There must not be a whitespace between the patterns:
au BufNewFile,BufRead *.js,*.html,*.css
See :help autocmd-patterns; it talks about comma-separated list, and the example there also doesn't have whitespace.
alternative approaches
By encoding the file patterns for the various languages, you're duplicating the built-in filetype detection.
I would recommend to put these :setlocal commands into ~/.vim/after/ftplugin/html.vim (and so on. This requires that you have :filetype plugin on; use of the after directory allows you to override any default filetype settings done by $VIMRUNTIME/ftplugin/html.vim.)
Alternatively, you could define an :autocmd FileType {filetype\} ... directly in your ~/.vimrc. This would at least avoid the duplication of file patterns, but tends to become unwieldy once you have many customizations.
I'm using vbscript via HP-UFT (former QTP).
I'm facing with issue which looks pretty simple but I couldn't fix it.
I have .CSV files exported from some system and there is no finished CRLF in this file.
I need a simple fix to append new line to this file (I know that is possible write-to-another-file workaround)
I'm using FileSystemObject like this:
Set objFile = objFSO.OpenTextFile(outFile,8)' (outFile,8, true/false/default)
objFile.Write "test string" & vbCrLf ' and other different combinations
I didn't use ADODB.Stream because it has not append function and I have no need to additional files
When I'm opening file in Notepad after my tries I see empty squares instead CRLF. I think it because file created with UCS-2 Little Endian encoding. I have no such issue with utf-8
PS maybe some more quick fix of system variable is possible? I have found in network that it possible to change default encoding for all created files via some system varibale but din't find it name.
My Language in Region and Language -> Administrative -> Language for non-Unicode is English
When in doubt, read the documentation:
Syntax
object.OpenTextFile(filename[, iomode[, create[, format]]])
Arguments
[...]
format
Optional. One of three Tristate values used to indicate the format of the opened file (TristateTrue = -1 to open the file as Unicode, TristateFalse = 0 to open the file as ASCII, TristateUseDefault = -2 to open the file as the system default). If omitted, the file is opened as ASCII.
You open the file for appending, but don't specify the encoding, so the interpreter assumes ASCII format. Change the line
Set objFile = objFSO.OpenTextFile(outFile,8)
to
Set objFile = objFSO.OpenTextFile(outFile, 8, False, -1)
and the problem will disappear.
I have a CSV file that I want to modify using batch to remove a string basically I have the next
randomID1, randomID2, randomID3, networkinterface, othercolumn1, othercolumn2,
abc123AAB, 098189909, 999181818, net on Server123, FORCED, anotherthing,
abc2455aB, 848449388, 123131232, LocalNet on SEV1, FORCED, otherlessstuff,
My relevant caracthers are Server123 and SEV1, so I need to convert the above on
randomID1, randomID2, randomID3, networkinterface, othercolumn1, othercolumn2,
abc123AAB, 098189909, 999181818, Server123, FORCED, anotherthing,
abc2455aB, 848449388, 123131232, SEV1, FORCED, otherlessstuff,
This means removing 'net on ' and 'LocalNet on ' strings.
How can I do this?
Batch language is far from ideal for this, but here's a basic script to simply line-by-line remove occurrences of "net on " and "LocalNet on " from input.txt and save the result as output.txt:
#ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
TYPE NUL > output.txt
FOR /F "delims=" %%L IN (input.txt) DO (
SET LINE=%%L
SET LINE=!LINE:LocalNet on =!
ECHO/!LINE:net on =!>> output.txt
)
Refinements are possible and may be needed. E.g., this won't work if the file contains reserved characters such as &. And it's not case sensitive. The latter is the reason the "LocalNet on " substitution is done before the "net on " substitution which is a substring when case insensitive. There's nothing CSV specific here because from your question that doesn't appear to be required. But if for example you needed to treat different comma-separated tokens differently, that can be done with a "delims=," option and some extra code.
I have a CSV file in which the starting first 2 characters are special character. I need to remove them from the file. Need to write a batch script for this. Please suggest.
þÿLEAD_CO_MNE~BRANCH_CO_MNE~MIS_DATE~#ID~LIMIT_ID~PROCESS_DATE~
This looks like unicode bom chars sequense. And you need to convert it to plain text.Open your file with notepad go to file->save and in 'encoding' choose ANSI.
Not sure if WinXP has this option.
If you want a script to handle this for you, use set /P "variable=" <csvfile to set a variable to the first line of the CSV file. Use string manipluation to strip out the BOM, then a for /f "skip=1" to append the rest of the file.
#echo off
setlocal
set "csvfile=test.csv"
<"%csvfile%" set /p "firstLine="
setlocal enabledelayedexpansion
>fixed.csv echo(!firstLine:*ÿ=!
endlocal
for /f "usebackq skip=1 delims=" %%I in ("%csvfile%") do (
>>fixed.csv echo(%%I
)
>NUL move /y fixed.csv "%csvfile%"
echo Fixed.
Combine cmd and type as follows:
For output as ANSI file without BOM
CHCP 1252 >NUL
start "" "%comspec%" /D /A /C type "path\file_with_BOM.csv">"path\file_-_BOM.csv"
For output as UNICODE file without BOM (here is a problem with endianity: Windows default to Little-Endian UTF-16LE, but your þÿ BOM looks like Big-Endian UTF-16BE)
CHCP 1252 >NUL
start "" "%comspec%" /D /U /C type "path\file_with_BOM.csv">"path\file_-_BOM.csv"
Code page 1252 is West European Latin, mine should be 1250 East European Latin; use CHCP with your locale-compliant proper page number