VIM + Scala Development environment

Source: Internet
Author: User
Tags sort

VIM Tools

Vim is a very useful tool, a small and capable code editor, no wonder many people are regarded as "The God of the editor." IDE Write code, in addition to the code debugging function, other functions vim can be implemented, and Vim does not occupy a lot of memory, so, write code using VIM is fully "enough."

Here's a look at the online configuration for developing a code environment with vim+ Scala



1 Ctags Installation

Download Ctags-x.x.tar

./configure && Make

Make install (need to use root user)

Configure Scala's Ctags profile, vim ~/.ctags, file contents See (Https://github.com/derekwyatt/vim-scala/blob/master/ctags/scala.ctags)



2 VIM Software Installation

Download Install TagList, cscope, Nerdtree, SRCEXPL, TRINITY



Add Scala support in TagList

Vim ~/.vim/plugin/taglist.vim



547 "Yacc language

548 Let s:tlist_def_yacc_settings = ' Yacc;l:label '

549

+ + 550 Let s:tlist_def_scala_settings = ' scala;t:trait;c:class; T:type, '.

+ + 551 \ ' M:method; C:constant;l:local;p:package;o:object '

552 "-------------------End of language specific options--------------------



3 VIMRC configuration file, the following is my. vimrc file

Call Pathogen#infect ()

Call Pathogen#helptags ()





Set nocompatible

Syntax on

FileType plugin on

FileType indent on

Set Autoindent

Set softtabstop=2

Set tabstop=2

Set shiftwidth=2

Set ai!

Set Showmatch

Set guioptions-=t

Set ruler

Set Nu

Set paste

ColorScheme Desert

Set Hlsearch



Set backup

Set Backupext=.shadow

Set backupdir=/tmp/vim/



""""""""""""""""""""""""""""""

"Tag list (ctags)

""""""""""""""""""""""""""""""

Let Tlist_ctags_cmd = '/usr/local/bin/ctags '

"TAGLIST

Let tlist_show_one_file=1

Let Tlist_exit_onlywindow=1







"Cscope

Set cscopequickfix=s-,c-,d-,i-,t-,e-







"Nerdtree

"Map <F2>:nerdtreetoggle<cr>

Map <F3>:nerdtreefind<cr>

Let nerdtreechdirmode=2 "Check root is set to the current directory

Let Nerdtreequitonopen=1 "close the tree when you open the file

Let Nerdtreeshowbookmarks=1 "show bookmarks

Let Nerdtreeminimalui=1 "does not display the Help panel

Let Nerdtreedirarrows=1 "directory Arrow 1 show arrows 0 traditional +-| number





Map <C-A>:!ctags-h ". Scala"-R .<cr>



"Srcexpl

"//The switch of the Source Explorer

"Nmap <F7>:srcexpltoggle<cr>



"//Set the height of the Source Explorer window

Let G:srcexpl_winheight = 8



"//Set ms for refreshing the Source Explorer

Let G:srcexpl_refreshtime = 100



"//Set" Enter "key to jump into the exactdefinition context

Let G:srcexpl_jumpkey = "<ENTER>"



"//Set" Space "key for back from the Definitioncontext

Let G:srcexpl_gobackkey = "<SPACE>"



"//In order to avoid conflicts, the Source Explorer shouldknow what plugins

"//except itself is using buffers. And you need add theirbuffer names into

"//below listaccording to the command": buffers! "

Let g:srcexpl_pluginlist = [

\ "__tag_list__",

\ "_nerd_tree_"

\ ]



"//enable/disable the local definition searching, and notethat this isn't

"//Guaranteed to work, the Source Explorer doesn ' t checkthe syntax.

"//It only searches for a match with the keyword accordingto command ' gd '

Let G:srcexpl_searchlocaldef = 1



The Source Explorer Update the tags file whenopening

Let G:srcexpl_isupdatetags = 0



"//Use ' exuberant Ctags ' with '--sort=foldcase-r. ' or '-lcscope.files ' to

"//Create/update the tags file

Let G:srcexpl_updatetagscmd = "ctags--sort=foldcase-r."



"//Set" <F12> "key for updating the tagsfile artificially

Let G:srcexpl_updatetagskey = "<F12>"



"//Set" <F4> "key for displaying theprevious definition in the Jump List

Let G:srcexpl_prevdefkey = "<F4>"



"//Set" <F5> "key for displaying the nextdefinition in the Jump List

Let G:srcexpl_nextdefkey = "<F5>"



"TRINITY

Open and close all the three plugins on the same time

Nmap <F8>:trinitytoggleall<cr>

Open and close the Srcexpl.vim separately

Nmap <F9>:trinitytogglesourceexplorer<cr>

Open and close the Taglist.vim separately

Nmap <F10>:trinitytoggletaglist<cr>

Open and close the Nerd_tree.vim separately

Nmap <F11>:trinitytogglenerdtree<cr>



4 Effect Diagram



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.