Vim에서 Julia의 구문 강조를 얻는 쉬운 방법
Julia가 Vim에서 구문 강조를 갖도록 노력하고 있습니다. 불행히도 현재로서는 구문 강조가 없습니다 ( 여기에 내 코드의 작은 스 니펫이 있으므로 현재 모양을 볼 수 있습니다 ). julia-vim을 설치하고 .vimrc 파일에 넣고 설치하려고 시도했지만 실제로 강조 표시가 변경되지는 않습니다. 다음은 .vimrc 파일입니다.
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own
plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or
just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append
`!` to auto-approve removal
"
Plugin 'JuliaEditorSupport/julia-vim'
"
"
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
julia-vim 문서를 읽은 후 수정하는 방법도 알고 있습니다 . 내가 잘못하고 있거나 Julia에 구문 강조 표시를 추가하는 다른 방법이 있습니까?
@Thomas 가 요청한이 질문에 대한 답변 중 하나에서 터미널을 설정 한 방법 일 수 있지만 가능하면 터미널을 현재 색 구성표로 유지하는 것을 선호합니다. 내 현재 설정은 여기를 참조하십시오.
편집 : @axwr 덕분에 구문 강조 표시를 얻을 수있었습니다.
syntax on
.vimrc 파일의 끝에 다음 실행
:so %
.vimrc 파일을 편집하는 동안. 그러나 여기 에서 볼 수 있듯이 색상 코딩은 이상적이지 않은 것 같습니다. 특정 패키지 만 노란색으로 표시되고 대부분은 여전히 녹색이며 임의의 항목 (보통 숫자)은 보라색으로 표시됩니다. 줄리아 빔이 색을 칠하는 방식인가요, 아니면 제가 뭘 잘못하고 있나요?
답변
좋아요.
Vim에서 구문 강조 표시에는 두 단계가 있습니다. 실제로 켜고 작업하려는 특정 언어를 강조 표시 할 수있는 기능이 있습니다. 대부분의 언어에서 vim은 기본적으로이 작업을 수행 할 수 있지만 Julia와 같은 일부 언어는 약간의 도움이 필요합니다. 이 경우 vundle을 사용하여 Julia 플러그인을 설치하여 2 단계를 완료했습니다.
1 단계를 달성하려면 syntax on
vimrc 파일에 다음 행만 있으면됩니다. 최소한의 vimrc 예제는 다음과 같습니다.
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'JuliaEditorSupport/julia-vim'
call vundle#end()
set nocompatible
set backspace=indent,eol,start
set number
set hidden
syntax on
filetype plugin indent on
위의 설정과 "solarised"색상 표가있는 터미널이 주어지면 julia 파일은 다음과 같습니다.

다음은 하이라이트와 비교할 수있는 작은 fizzbuzz julia 스 니펫입니다.
for i in 1:100
if i % 15 == 0
println("FizzBuzz")
elseif i % 3 == 0
println("Fizz")
elseif i % 5 == 0
println("Buzz")
else
println(i)
end
end
따라서 단계별로 :
- 추가
syntax on
로.vimrc
- 추가
filetype plugin indent on
로.vimrc
- 관련 플러그인 설치
- 귀하
.vimrc
또는 가까운 정력을 소싱하십시오 . - 올바른 확장자를 가진 파일을 엽니 다.
test.jl