我是新来使用新的,所以请原谅我,如果修复太明显。
我遇到的问题是,如果我使用命令创建一个文件。
nvim file.txt
然后编辑它比如说
hello
然后使用:w
保存它,文件将显示如下
hello^M
我尝试了命令:set ff=unix
,但不起作用。我认为问题出在我从https://github.com/craftzdog/dotfiles-public获取的init.vim上
并将其修改为不使用fish作为终端,则代码如下所示。
" Fundamentals "{{{
" ---------------------------------------------------------------------
" init autocmd
autocmd!
" set script encoding
scriptencoding utf-8
" stop loading config if it's on tiny or small
if !1 | finish | endif
set nocompatible
set number
syntax enable
set fileencodings=utf-8,sjis,euc-jp,latin
set encoding=utf-8
set title
set autoindent
set background=dark
set nobackup
set hlsearch
set showcmd
set cmdheight=1
set laststatus=2
set scrolloff=10
set expandtab
"let loaded_matchparen = 1
set shell=powershell.exe
set backupskip=/tmp/*,/private/tmp/*
" incremental substitution (neovim)
if has('nvim')
set inccommand=split
endif
" Suppress appending <PasteStart> and <PasteEnd> when pasting
set t_BE=
set nosc noru nosm
" Don't redraw while executing macros (good performance config)
set lazyredraw
"set showmatch
" How many tenths of a second to blink when matching brackets
"set mat=2
" Ignore case when searching
set ignorecase
" Be smart when using tabs ;)
set smarttab
" indents
filetype plugin indent on
set shiftwidth=2
set tabstop=2
set ai "Auto indent
set si "Smart indent
set nowrap "No Wrap lines
set backspace=start,eol,indent
" Finding files - Search down into subfolders
set path+=**
set wildignore+=*/node_modules/*
" Turn off paste mode when leaving insert
autocmd InsertLeave * set nopaste
" Add asterisks in block comments
set formatoptions+=r
"}}}
" Highlights "{{{
" ---------------------------------------------------------------------
set cursorline
"set cursorcolumn
" Set cursor line color on visual mode
highlight Visual cterm=NONE ctermbg=236 ctermfg=NONE guibg=Grey40
highlight LineNr cterm=none ctermfg=240 guifg=#2b506e guibg=#000000
augroup BgHighlight
autocmd!
autocmd WinEnter * set cul
autocmd WinLeave * set nocul
augroup END
if &term =~ "screen"
autocmd BufEnter * if bufname("") !~ "^?[A-Za-z0-9?]*://" | silent! exe '!echo -n "\ek[`hostname`:`basename $PWD`/`basename %`]\e\\"' | endif
autocmd VimLeave * silent! exe '!echo -n "\ek[`hostname`:`basename $PWD`]\e\\"'
endif
"}}}
" File types "{{{
" ---------------------------------------------------------------------
" JavaScript
au BufNewFile,BufRead *.es6 setf javascript
" TypeScript
au BufNewFile,BufRead *.tsx setf typescriptreact
" Markdown
au BufNewFile,BufRead *.md set filetype=markdown
au BufNewFile,BufRead *.mdx set filetype=markdown
" Flow
au BufNewFile,BufRead *.flow set filetype=javascript
" powershell
au BufNewFile,BufRead *.pwsh set filetype=powershell
set suffixesadd=.js,.es,.jsx,.json,.css,.less,.sass,.styl,.php,.py,.md
autocmd FileType coffee setlocal shiftwidth=2 tabstop=2
autocmd FileType ruby setlocal shiftwidth=2 tabstop=2
autocmd FileType yaml setlocal shiftwidth=2 tabstop=2
"}}}
" Imports "{{{
" ---------------------------------------------------------------------
runtime ./plug.vim
if has("unix")
let s:uname = system("uname -s")
" Do Mac stuff
if s:uname == "Darwin\n"
runtime ./macos.vim
endif
endif
if has('win32')
runtime ./windows.vim
endif
runtime ./maps.vim
"}}}
" Syntax theme "{{{
" ---------------------------------------------------------------------
" true color
if exists("&termguicolors") && exists("&winblend")
syntax enable
set termguicolors
set winblend=0
set wildoptions=pum
set pumblend=5
set background=dark
" Use NeoSolarized
let g:neosolarized_termtrans=1
runtime ./colors/NeoSolarized.vim
colorscheme NeoSolarized
endif
"}}}
" Extras "{{{
" ---------------------------------------------------------------------
set exrc
"}}}
" vim: set foldmethod=marker foldlevel=0:
任何帮助都将不胜感激
简要说明似乎只有在**.tsx**文件时才会出现此问题
1条答案
按热度按时间but5z9lq1#
我终于找到了罪魁祸首。它更漂亮,我从lspconfig.rc文件中删除它作为临时解决方案,请让我知道如果你为什么会发生这种情况