├── .gitignore ├── README.md ├── build.gradle ├── classpath.sh ├── lib └── README ├── screenshot-vimjava.jpg └── src ├── main ├── java │ └── README └── resources │ └── README └── test ├── java └── README └── resources └── README /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | .gradle/ 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Vim for Java Development 2 | ======================== 3 | 4 | A skeleton of Vim for Java Development with Gradle. This is shell-oriented thing, probably not of your taste. If you prefer doing Java development mostly in terminal/shell, you will feel right at home. I use [GNU Bash](http://www.gnu.org/software/bash/). You may make any adjustment in `classpath.sh` and `source classpath.sh` command below if you use other shells (tcsh, zsh, ksh, /etc). 5 | 6 | License 7 | ------- 8 | 9 | I don't take credit for all Vim plugins described here. I only put them in one place and explain what you can do to use them effectively for Java development. See the website of all plugins here to know the license. 10 | 11 | Here's How 12 | ---------- 13 | 14 | * You have [Gradle](http://gradle.org) [installed and run correctly](http://www.gradle.org/docs/current/userguide/installation.html), right? 15 | * Using Vim for all development tasks is cool, but even cooler if you use [Pathogen](https://github.com/tpope/vim-pathogen). If you don't, well, you should... 16 | * Put all these plugins in `$HOME/.vim/bundle` just as Pathogen told you (see also `$HOME/.vim/vimrc` below): 17 | 18 | * [indentLine](https://github.com/Yggdroot/indentLine) 19 | * [vim-gradle](https://github.com/tfnico/vim-gradle) 20 | * [javacomplete](https://github.com/adragomir/javacomplete) 21 | * [syntastic](https://github.com/scrooloose/syntastic) 22 | * [tagbar](https://github.com/majutsushi/tagbar) 23 | * [nerdtree](https://github.com/scrooloose/nerdtree) 24 | * [vim-colorschemes](https://github.com/flazz/vim-colorschemes) - life isn't beautiful without color :p 25 | * [vim-smartusline](https://github.com/molok/vim-smartusline) 26 | 27 | * Put all of the Gradle dependencies into build.gradle then issue `gradle build`. That way, all of dependencies will be downloaded in `$HOME/.gradle`. See `build.gradle` file for example, or if you want, you may open [Dependency Management chapter](http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html) in Gradle manual. 28 | * Issue command `gradle copyToLib` to copy all of the dependencies into lib dir 29 | * Issue command `source classpath.sh` 30 | * gvim, and you are on your way. 31 | * Use `:TagbarOpen` if you want to open tagbar for active Java source code 32 | * You may use Omni Completion also, like `import org.`. When I say ``, it means you press `Ctrl with X`. 33 | 34 | $HOME/.vim/vimrc 35 | ---------------- 36 | 37 | execute pathogen#infect() 38 | 39 | set nocompatible 40 | syntax on 41 | filetype plugin indent on 42 | set ofu=syntaxcomplete#Complete 43 | 44 | if has("gui_running") 45 | colorscheme zenburn 46 | else 47 | colorscheme slate 48 | endif 49 | 50 | set smartindent 51 | set tabstop=2 52 | set shiftwidth=2 53 | set expandtab 54 | set cursorline 55 | 56 | " Default Colors for CursorLine 57 | highlight CursorLine ctermbg=Yellow ctermfg=None 58 | 59 | " Change Color when entering Insert Mode 60 | autocmd InsertEnter * highlight CursorLine ctermbg=Darkgray ctermfg=Red 61 | 62 | " Revert Color to default when leaving Insert Mode 63 | autocmd InsertLeave * highlight CursorLine ctermbg=Yellow ctermfg=None 64 | 65 | autocmd vimenter * NERDTree 66 | autocmd vimenter * if !argc() | NERDTree | endif 67 | autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif 68 | 69 | let g:NERDTreeDirArrows=0 70 | let g:NERDTreeWinSize = 15 71 | 72 | au BufRead,BufNewFile *.gradle set filetype=groovy 73 | 74 | let g:cssColorVimDoNotMessMyUpdatetime = 1 75 | set guifont=Liberation\ Mono\ 11 76 | 77 | set number 78 | set numberwidth=4 79 | set cpoptions+=n 80 | highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE 81 | 82 | 83 | set grepprg=grep\ -nH\ $* 84 | let g:tex_flavour = "latex" 85 | 86 | set foldmethod=indent 87 | set foldnestmax=2 88 | 89 | " vertical line indentation 90 | let g:indentLine_color_term = 239 91 | let g:indentLine_color_gui = '#09AA08' 92 | " let g:indentLine_color_gui = '#A4AAAA' 93 | let g:indentLine_char = '│' 94 | 95 | hi Modified guifg=black guibg=#FFA500 96 | set statusline=%2.2n\ %t\ %h%#Modified#%m%r%*%=%l/%L\ %2c\ %P 97 | let g:smartusline_string_to_highlight = '%2.2n %t %h' 98 | 99 | au BufNewFile,BufRead *.groovy setf groovy 100 | au BufNewFile,BufRead *.gradle setf groovy 101 | 102 | if has("autocmd") 103 | autocmd Filetype java setlocal omnifunc=javacomplete#Complete 104 | endif 105 | 106 | setlocal completefunc=javacomplete#CompleteParamsInfo 107 | 108 | 109 | Screenshots? 110 | ------------ 111 | 112 | See here if you are difficult to be convinced :p 113 | 114 | ![ScreenshotVimJavaPng](screenshot-vimjava.jpg) 115 | 116 | Author 117 | ------ 118 | [Bambang Purnomosidi D. P.](http://bpdp.name) 119 | * Email: bambangpdp-with-domain-name-yahoocom-or-gmailcom 120 | * Facebook: [/bambangpdp](http://www.facebook.com/bambangpdp) 121 | * Twitter: [@bpdp](http://twitter.com/bpdp) 122 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: 'project-report' 3 | 4 | version = "0.0.1" 5 | group = "whatever.group.change.it" 6 | 7 | dependencies { 8 | 9 | // just some examples 10 | compile group: 'org.glassfish.grizzly', name: 'grizzly-framework', version: '2.3.3' 11 | compile group: 'org.glassfish.grizzly', name: 'grizzly-http-server', version: '2.3.3' 12 | 13 | testCompile group: 'junit', name: 'junit', version: '4.11' 14 | 15 | } 16 | 17 | repositories { 18 | mavenCentral() 19 | } 20 | 21 | task(runApp, dependsOn: 'classes', type: JavaExec) { 22 | main = 'name.bpdp.grizzly.BlockingHttpHandlerSample' 23 | classpath = sourceSets.main.runtimeClasspath 24 | // put also args and systemProperty if you like 25 | //args 'arg' 26 | //systemProperty 'first.property', 'EHLO' 27 | } 28 | 29 | test { 30 | maxParallelForks = 5 31 | maxHeapSize = '1024m' 32 | } 33 | 34 | // copy all needed jar after gradle build 35 | task copyToLib(type: Copy) { 36 | into "lib" 37 | from configurations.runtime 38 | } 39 | -------------------------------------------------------------------------------- /classpath.sh: -------------------------------------------------------------------------------- 1 | export CLASSPATH=$CLASSPATH:lib/* 2 | -------------------------------------------------------------------------------- /lib/README: -------------------------------------------------------------------------------- 1 | This directory will be filled with all jar dependencies 2 | -------------------------------------------------------------------------------- /screenshot-vimjava.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bpdp/vim-java/e9b5ab9e765fcafd3bbc259d125b85c58efdb3ea/screenshot-vimjava.jpg -------------------------------------------------------------------------------- /src/main/java/README: -------------------------------------------------------------------------------- 1 | All source code will be here 2 | -------------------------------------------------------------------------------- /src/main/resources/README: -------------------------------------------------------------------------------- 1 | all resources source code here 2 | -------------------------------------------------------------------------------- /src/test/java/README: -------------------------------------------------------------------------------- 1 | all test here 2 | -------------------------------------------------------------------------------- /src/test/resources/README: -------------------------------------------------------------------------------- 1 | all resources test here 2 | --------------------------------------------------------------------------------