2

请向我推荐一个好的编辑器,我可以在其中从支持语法高亮的 Unix 编辑器中打开文件。我一直在使用vi编辑器。我尝试了 ESC :syntax 但这没有帮助

4

4 回答 4

3

vim 工作正常,你只需要告诉它什么是 .bat 文件。

如果 vim 不能自动识别文件,你可以告诉它如何用:set filetype=bat.

于 2012-08-02T21:02:20.707 回答
3

我希望这是你想要的.. 不需要使用任何其他编辑器.. 你可以使用和配置 vi 编辑器

VI 和 VIM 语法高亮

这是我的示例屏幕截图。我正在使用此处的 .bat 文件代码..

在此处输入图像描述

这是我的 ~/.vimrc 文件配置

syntax on
set background=dark
set ruler                     " show the line number on the bar
set more                      " use more prompt
set autoread                  " watch for file changes
set number                    " line numbers
set hidden
set noautowrite               " don't automagically write on :next
set lazyredraw                " don't redraw when don't have to
set showmode
set showcmd
set nocompatible              " vim, not vi
set autoindent smartindent    " auto/smart indent
set smarttab                  " tab and backspace are smart
set tabstop=2                 " 6 spaces
set shiftwidth=2
set scrolloff=5               " keep at least 5 lines above/below
set sidescrolloff=5           " keep at least 5 lines left/right
set history=200
set backspace=indent,eol,start
set linebreak
set cmdheight=2               " command line two lines high
set undolevels=1000           " 1000 undos
set updatecount=100           " switch every 100 chars
set complete=.,w,b,u,U,t,i,d  " do lots of scanning on tab completion
set ttyfast                   " we have a fast terminal
set noerrorbells              " No error bells please
set shell=bash
set fileformats=unix
set ff=unix
filetype on                   " Enable filetype detection
filetype indent on            " Enable filetype-specific indenting
filetype plugin on            " Enable filetype-specific plugins
set wildmode=longest:full
set wildmenu                  " menu has tab completion
let maplocalleader=','        " all my macros start with ,
set laststatus=2
nore ; :
nore , ;

map ,<Tab> :set hls<CR>/\\n.*\\n/<CR>
set statusline=%2*%n\|%<%*%-.40F%2*\|\ %2*%M\ %3*%=%1*\ %1*%2.6l%2*x%1*%1.9(%c%V%)%2*[%1*%P%2*]%1*%2B

"  searching
set incsearch                 " incremental search
set ignorecase                " search ignoring case
set hlsearch                  " highlight the search
set showmatch                 " show matching bracket
set diffopt=filler,iwhite     " ignore all whitespace and sync

"  backup
" set backup
" set backupdir=~/.vim_backup
" set viminfo=%100,'100,/100,h,\"500,:100,n~/.viminfo
"set viminfo='100,f1

" spelling
if v:version >= 700
  " Enable spell check for text files
  autocmd BufNewFile,BufRead *.txt setlocal spell spelllang=en
endif

" mappings
" toggle list mode
nmap <LocalLeader>tl :set list!<cr>
" toggle paste mode
nmap <LocalLeader>pp :set paste!<cr>


""""""""""""""""""""""""""""""""""""""""""""""""
" Dark background
""""""""""""""""""""""""""""""""""""""""""""""""

"I always work on dark terminals
" set background=dark

"Make the completion menus readable
highlight Pmenu ctermfg=0 ctermbg=3
highlight PmenuSel ctermfg=0 ctermbg=7

"The following should be done automatically for the default colour scheme
"at least, but it is not in Vim 7.0.17.
if &bg == "dark"
  highlight MatchParen ctermbg=darkblue guibg=blue
endif
于 2012-08-03T04:59:56.563 回答
0

如果你想要一个终端编辑器,你可以使用 vim。如果你想要一个 GUI,你可以使用 gedit,它很简单并且支持多种语言的高亮显示。

于 2012-08-02T21:04:46.540 回答
0

如果您不喜欢 vi,请尝试使用 emacs :-)

于 2012-08-02T21:07:37.937 回答