1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:40:05 +08:00

Merge branch 'dev' into fork-lua-layer-improvements

This commit is contained in:
Arith Xu 2017-12-20 09:32:18 +08:00
commit 0a643ea9cc
7 changed files with 253 additions and 105 deletions

View File

@ -5,39 +5,63 @@
"
" @subsection Mappings
" >
" Import mappings:
" Import key bindings:
"
" Mode Key Function
" -------------------------------------------------------------
" normal <F4> import class under cursor
" insert <F4> import class under cursor
" normal <leader>jI import missing classes
" normal <leader>jR remove unused imports
" normal <leader>ji smart import class under cursor
" normal <leader>jii same as <F4>
" normal SPC l I import missing classes
" normal SPC l R remove unused imports
" normal SPC l i smart import class under cursor
" insert <c-j>I import missing imports
" insert <c-j>R remove unused imports
" insert <c-j>i smart import class under cursor
" insert <c-j>ii add import for class under cursor
"
" Generate mappings:
" Generate key bindings:
"
" Mode Key Function
" -------------------------------------------------------------
" normal <leader>jA generate accessors
" normal <leader>js generate setter accessor
" normal <leader>jg generate getter accessor
" normal <leader>ja generate setter and getter accessor
" normal <leader>jts generate toString function
" normal <leader>jeq generate equals and hashcode function
" normal <leader>jc generate constructor
" normal <leader>jcc generate default constructor
" insert <c-j>s generate setter accessor
" insert <c-j>g generate getter accessor
" insert <c-j>a generate getter and setter accessor
" visual <leader>js generate setter accessor
" visual <leader>jg generate getter accessor
" visual <leader>ja generate setter and getter accessor
" normal SPC l g A generate accessors
" normal SPC l g s generate setter accessor
" normal SPC l g g generate getter accessor
" normal SPC l g a generate setter and getter accessor
" normal SPC l g t generate toString function
" normal SPC l g e generate equals and hashcode function
" normal SPC l g c generate constructor
" normal SPC l g C generate default constructor
" insert <c-j>s generate setter accessor
" insert <c-j>g generate getter accessor
" insert <c-j>a generate getter and setter accessor
" visual SPC l g s generate setter accessor
" visual SPC l g g generate getter accessor
" visual SPC l g a generate setter and getter accessor
"
" Maven key bindings:
"
" Mode Key Function
" -------------------------------------------------------------
" normal SPC l m i Run maven clean install
" normal SPC l m I Run maven install
" normal SPC l m p Run one already goal from list
" normal SPC l m r Run maven goals
" normal SPC l m R Run one maven goal
" normal SPC l m t Run maven test
"
" Jump key bindings:
"
" Mode Key Function
" -------------------------------------------------------------
" normal SPC l j a jump to alternate file
"
" REPL key bindings:
"
" Mode Key Function
" -------------------------------------------------------------
" normal SPC l s i start a jshell inferior REPL process
" normal SPC l s b send buffer and keep code buffer focused
" normal SPC l s l send line and keep code buffer focused
" normal SPC l s s send selection text and keep code buffer focused
" <
" @subsection Code formatting
" To make neoformat support java file, you should install uncrustify.
@ -60,6 +84,7 @@ endfunction
function! SpaceVim#layers#lang#java#config() abort
call SpaceVim#mapping#space#regesit_lang_mappings('java', funcref('s:language_specified_mappings'))
call SpaceVim#plugins#repl#reg('java', 'jshell')
augroup SpaceVim_lang_java
au!
autocmd FileType java setlocal omnifunc=javacomplete#Complete
@ -95,31 +120,32 @@ function! s:language_specified_mappings() abort
\ 'Smart import class under cursor', 0)
" Generate key bindings
call SpaceVim#mapping#space#langSPC('nmap', ['l','A'],
let g:_spacevim_mappings_space.l.g = {'name' : '+Generate'}
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'g', 'A'],
\ '<Plug>(JavaComplete-Generate-Accessors)',
\ 'generate setter accessor', 0)
call SpaceVim#mapping#space#langSPC('nmap', ['l','s'],
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'g', 's'],
\ '<Plug>(JavaComplete-Generate-AccessorSetter)',
\ 'generate setter accessor', 0)
call SpaceVim#mapping#space#langSPC('nmap', ['l','g'],
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'g', 'g'],
\ '<Plug>(JavaComplete-Generate-AccessorGetter)',
\ 'generate getter accessor', 0)
call SpaceVim#mapping#space#langSPC('nmap', ['l','a'],
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'g', 'a'],
\ '<Plug>(JavaComplete-Generate-AccessorSetterGetter)',
\ 'generate setter and getter accessor', 0)
call SpaceVim#mapping#space#langSPC('nmap', ['l','M'],
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'g', 'M'],
\ '<Plug>(JavaComplete-Generate-AbstractMethods)',
\ 'Generate abstract methods', 0)
call SpaceVim#mapping#space#langSPC('nmap', ['l','c'],
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'g', 'c'],
\ '<Plug>(JavaComplete-Generate-Constructor)',
\ 'Generate constructor', 0)
call SpaceVim#mapping#space#langSPC('nmap', ['l','C'],
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'g', 'C'],
\ '<Plug>(JavaComplete-Generate-DefaultConstructor)',
\ 'Generate default constructor', 0)
call SpaceVim#mapping#space#langSPC('nmap', ['l','eq'],
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'g', 'e'],
\ '<Plug>(JavaComplete-Generate-EqualsAndHashCode)',
\ 'Generate equals functions', 0)
call SpaceVim#mapping#space#langSPC('nmap', ['l','ts'],
call SpaceVim#mapping#space#langSPC('nmap', ['l', 'g', 't'],
\ '<Plug>(JavaComplete-Generate-ToString)',
\ 'Generate toString function', 0)
@ -152,6 +178,19 @@ function! s:language_specified_mappings() abort
call SpaceVim#mapping#space#langSPC('nnoremap', ['l','m', 't'], 'call call('
\ . string(function('s:execCMD')) . ', ["mvn test"])',
\ 'Run maven test', 1)
let g:_spacevim_mappings_space.l.s = {'name' : '+Send'}
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'],
\ 'call SpaceVim#plugins#repl#start("java")',
\ 'start REPL process', 1)
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'l'],
\ 'call SpaceVim#plugins#repl#send("line")',
\ 'send line and keep code buffer focused', 1)
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'b'],
\ 'call SpaceVim#plugins#repl#send("buffer")',
\ 'send buffer and keep code buffer focused', 1)
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'],
\ 'call SpaceVim#plugins#repl#send("selection")',
\ 'send selection and keep code buffer focused', 1)
endfunction
function! s:java_mappings() abort

View File

@ -87,14 +87,12 @@ if has('nvim') && exists('*chanclose')
if s:_out_data[-1] == ''
call remove(s:_out_data, -1)
let lines = s:_out_data
else
let lines = s:_out_data
if !empty(lines)
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines)
endif
let s:_out_data = ['']
let s:lines += len(lines)
endif
if !empty(lines)
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines)
endif
let s:lines += len(lines)
let s:_out_data = ['']
call s:update_statusline()
endfunction

View File

@ -37,18 +37,19 @@ CONTENTS *SpaceVim-contents*
14. lang#java.................................|SpaceVim-layer-lang-java|
15. lang#julia...............................|SpaceVim-layer-lang-julia|
16. lang#kotlin.............................|SpaceVim-layer-lang-kotlin|
17. lang#ocaml...............................|SpaceVim-layer-lang-ocaml|
18. lang#php...................................|SpaceVim-layer-lang-php|
19. lang#pony.................................|SpaceVim-layer-lang-pony|
20. lang#puppet.............................|SpaceVim-layer-lang-puppet|
21. lang#python.............................|SpaceVim-layer-lang-python|
22. lang#rust.................................|SpaceVim-layer-lang-rust|
23. lang#scala...............................|SpaceVim-layer-lang-scala|
24. lang#tmux.................................|SpaceVim-layer-lang-tmux|
25. lang#xml...................................|SpaceVim-layer-lang-xml|
26. operator...................................|SpaceVim-layer-operator|
27. shell.........................................|SpaceVim-layer-shell|
28. tmux...........................................|SpaceVim-layer-tmux|
17. lang#lua...................................|SpaceVim-layer-lang-lua|
18. lang#ocaml...............................|SpaceVim-layer-lang-ocaml|
19. lang#php...................................|SpaceVim-layer-lang-php|
20. lang#pony.................................|SpaceVim-layer-lang-pony|
21. lang#puppet.............................|SpaceVim-layer-lang-puppet|
22. lang#python.............................|SpaceVim-layer-lang-python|
23. lang#rust.................................|SpaceVim-layer-lang-rust|
24. lang#scala...............................|SpaceVim-layer-lang-scala|
25. lang#tmux.................................|SpaceVim-layer-lang-tmux|
26. lang#xml...................................|SpaceVim-layer-lang-xml|
27. operator...................................|SpaceVim-layer-operator|
28. shell.........................................|SpaceVim-layer-shell|
29. tmux...........................................|SpaceVim-layer-tmux|
6. API........................................................|SpaceVim-api|
1. cmdlinemenu................................|SpaceVim-api-cmdlinemenu|
2. data#list....................................|SpaceVim-api-data-list|
@ -844,39 +845,63 @@ This layer is for Java development.
MAPPINGS
>
Import mappings:
Import key bindings:
Mode Key Function
-------------------------------------------------------------
normal <F4> import class under cursor
insert <F4> import class under cursor
normal <leader>jI import missing classes
normal <leader>jR remove unused imports
normal <leader>ji smart import class under cursor
normal <leader>jii same as <F4>
normal SPC l I import missing classes
normal SPC l R remove unused imports
normal SPC l i smart import class under cursor
insert <c-j>I import missing imports
insert <c-j>R remove unused imports
insert <c-j>i smart import class under cursor
insert <c-j>ii add import for class under cursor
Generate mappings:
Generate key bindings:
Mode Key Function
-------------------------------------------------------------
normal <leader>jA generate accessors
normal <leader>js generate setter accessor
normal <leader>jg generate getter accessor
normal <leader>ja generate setter and getter accessor
normal <leader>jts generate toString function
normal <leader>jeq generate equals and hashcode function
normal <leader>jc generate constructor
normal <leader>jcc generate default constructor
insert <c-j>s generate setter accessor
insert <c-j>g generate getter accessor
insert <c-j>a generate getter and setter accessor
visual <leader>js generate setter accessor
visual <leader>jg generate getter accessor
visual <leader>ja generate setter and getter accessor
normal SPC l g A generate accessors
normal SPC l g s generate setter accessor
normal SPC l g g generate getter accessor
normal SPC l g a generate setter and getter accessor
normal SPC l g t generate toString function
normal SPC l g e generate equals and hashcode function
normal SPC l g c generate constructor
normal SPC l g C generate default constructor
insert <c-j>s generate setter accessor
insert <c-j>g generate getter accessor
insert <c-j>a generate getter and setter accessor
visual SPC l g s generate setter accessor
visual SPC l g g generate getter accessor
visual SPC l g a generate setter and getter accessor
Maven key bindings:
Mode Key Function
-------------------------------------------------------------
normal SPC l m i Run maven clean install
normal SPC l m I Run maven install
normal SPC l m p Run one already goal from list
normal SPC l m r Run maven goals
normal SPC l m R Run one maven goal
normal SPC l m t Run maven test
Jump key bindings:
Mode Key Function
-------------------------------------------------------------
normal SPC l j a jump to alternate file
REPL key bindings:
Mode Key Function
-------------------------------------------------------------
normal SPC l s i start a jshell inferior REPL process
normal SPC l s b send buffer and keep code buffer focused
normal SPC l s l send line and keep code buffer focused
normal SPC l s s send selection text and keep code buffer focused
<
CODE FORMATTING
To make neoformat support java file, you should install uncrustify. or
@ -898,6 +923,20 @@ LANG#KOTLIN *SpaceVim-layer-lang-kotlin*
This layer is for kotlin development.
==============================================================================
LANG#LUA *SpaceVim-layer-lang-lua*
This layer includes utilities and language-specific mappings for lua
development.
MAPPINGS
>
Mode Key Function
---------------------------------------------
normal SPC l r lua run
<
==============================================================================
LANG#OCAML *SpaceVim-layer-lang-ocaml*

View File

@ -9,12 +9,15 @@ redirect_from: "/2017/02/11/use-vim-as-a-java-ide.html"
I am a vimmer and a java developer. Here are some useful plugins for developing java in vim/neovim.
![2017-02-01_1360x721](https://cloud.githubusercontent.com/assets/13142418/22506638/84705532-e8bc-11e6-8b72-edbdaf08426b.png)
![beautiful UI](https://user-images.githubusercontent.com/13142418/33804722-bc241f50-dd70-11e7-8dd8-b45827c0019c.png)
## Project manager
1. [unite](https://github.com/Shougo/unite.vim) - file and code fuzzy founder.
![](https://s3.amazonaws.com/github-csexton/unite-01.gif)
The next version of unite is [denite](https://github.com/Shougo/denite.nvim), Denite is a dark powered plugin for Neovim/Vim to unite all interfaces.
![unite](https://s3.amazonaws.com/github-csexton/unite-01.gif)
The unite or unite.vim plug-in can search and display information from arbitrary sources like files, buffers, recently used files or registers. You can run several pre-defined actions on a target displayed in the unite window.
@ -22,7 +25,7 @@ The difference between unite and similar plug-ins like fuzzyfinder, ctrl-p or ku
You can also use unite with [ag](https://github.com/ggreer/the_silver_searcher), that will make searching faster.
*config unite with ag or other tools support*
_config unite with ag or other tools support_
```viml
if executable('hw')
@ -75,7 +78,8 @@ endif
2. [vimfiler](https://github.com/Shougo/vimfiler.vim) - A powerful file explorer implemented in Vim script
*Use vimfiler as default file explorer*
_Use vimfiler as default file explorer_
> for more information, you should read the documentation of vimfiler.
```viml
@ -111,17 +115,18 @@ BTW, the google's [java formatter](https://github.com/google/google-java-format)
## Code completion
1. [javacomplete2](https://github.com/artur-shaik/vim-javacomplete2) - Updated javacomplete plugin for vim
- Demo
![vim-javacomplete2](https://github.com/artur-shaik/vim-javacomplete2/raw/master/doc/demo.gif)
- Demo
- Generics demo
![vim-javacomplete2](https://github.com/artur-shaik/vim-javacomplete2/raw/master/doc/demo.gif)
![vim-javacomplete2](https://github.com/artur-shaik/vim-javacomplete2/raw/master/doc/generics_demo.gif)
- Generics demo
![vim-javacomplete2](https://github.com/artur-shaik/vim-javacomplete2/raw/master/doc/generics_demo.gif)
2. [deoplete.nvim](https://github.com/Shougo/deoplete.nvim) - Dark powered asynchronous completion framework for neovim
3. [neocomplete.vim](https://github.com/Shougo/neocomplete.vim) - Next generation completion framework after neocomplcache
3. [neocomplete.vim](https://github.com/Shougo/neocomplete.vim) - Next generation completion framework after neocomplcache
## Syntax lint
@ -130,4 +135,8 @@ BTW, the google's [java formatter](https://github.com/google/google-java-format)
I am maintainer of javac maker in neomake, the javac maker support maven project, gradle project or eclipse project.
also you can set the classpath.
## REPL
you need to install jdk8 which provide a build-in tools `jshell`, and SpaceVim use the `jshell` as default inferior REPL process:
![REPl-JAVA](https://user-images.githubusercontent.com/13142418/34159605-758461ba-e48f-11e7-873c-fc358ce59a42.gif)

View File

@ -33,6 +33,7 @@ call SpaceVim#layers#load('shell',
| [git](https://spacevim.org/layers/git/) | This layers adds extensive support for git |
| [lang#c](https://spacevim.org/layers/lang/c/) | This layer is for c/c++/object-c development |
| [lang#elixir](https://spacevim.org/layers/lang/elixir/) | This layer is for elixir development, provide autocompletion, syntax checking, code format for elixir file. |
| [lang#go](https://spacevim.org/layers/lang/go/) | This layer is for go development |
| [lang#java](https://spacevim.org/layers/lang/java/) | This layer is for Java development |
| [lang#javascript](https://spacevim.org/layers/lang/javascript/) | This layer is for JaveScript development |
| [lang#lisp](https://spacevim.org/layers/lang/lisp/) | for lisp development |

45
docs/layers/lang/go.md Normal file
View File

@ -0,0 +1,45 @@
---
title: "SpaceVim golang layer"
description: "This layer is for golang development. It also provides additional language-specific key mappings."
---
# [SpaceVim Layers:](https://spacevim.org/layers) go
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Install](#install)
- [Key bindings](#key-bindings)
<!-- vim-markdown-toc -->
## Description
This layer is for golang development. It also provides additional language-specific key mappings.
## Install
To use this configuration layer, add `SPLayer 'lang#go` to your custom configuration file.
## Key bindings
**Import key bindings:**
| Key Binding | Description |
| ----------- | ---------------------------------------- |
| SPC l i | go implements |
| SPC l f | go info |
| SPC l e | go rename |
| SPC l r | go run |
| SPC l b | go build |
| SPC l t | go test |
| SPC l d | go doc |
| SPC l v | go doc vertical |
| SPC l c | go coverage |
**Code formatting:**
the default key bindings for format current buffer is `SPC b f`, and this key bindings is defined in [format layer](<>). you can also use `g=` to indent current buffer.
To make neoformat support go files, you should have [go-fmt](http://golang.org/cmd/gofmt/) command available, or
install [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports). `go-fmt` is delivered by golang's default installation, so make sure you have correctly setup your go environment.

View File

@ -1,6 +1,6 @@
---
title: "SpaceVim lang#java layer"
description: "This layer is for Java development"
description: "This layer is for Java development. All the features such as code completion, formatting, syntax checking, REPL and debug have be done in this layer."
---
# [SpaceVim Layers:](https://spacevim.org/layers) lang#java
@ -8,13 +8,15 @@ description: "This layer is for Java development"
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Layer Installation](#layer-installation)
- [Feature](#feature)
- [Install](#install)
- [Key bindings](#key-bindings)
- [Java language specified key bindings](#java-language-specified-key-bindings)
- [Maven](#maven)
- [Jump](#jump)
- [Problems buffer](#problems-buffer)
- [Project buffer](#project-buffer)
- [Import key bindings](#import-key-bindings)
- [Generate key bindings](#generate-key-bindings)
- [Code formatting](#code-formatting)
- [Maven](#maven)
- [Jump](#jump)
- [Inferior REPL process](#inferior-repl-process)
<!-- vim-markdown-toc -->
@ -22,15 +24,22 @@ description: "This layer is for Java development"
This layer is for Java development.
## Layer Installation
## Feature
- code completion: `autocomplete` layer
- code formatting
- refactoring
- syntax checking: `checkers` layer
- REPL(need java8's jshell)
- debug: check out the `debug` layer
## Install
To use this configuration layer, add `SPLayer 'lang#java'` to your custom configuration file.
## Key bindings
### Java language specified key bindings
**Import key bindings:**
### Import key bindings
| Key Binding | Description |
| -------------------- | ------------------------------- |
@ -42,24 +51,24 @@ To use this configuration layer, add `SPLayer 'lang#java'` to your custom config
| `<C-j>R` (Insert) | Remove unused classes |
| `<C-j>i` (Insert) | smart import class under cursor |
**Generate key bindings:**
### Generate key bindings
| Mode | Key Binding | Description |
| ------------- | ----------- | ------------------------------------- |
| normal | `SPC l A` | generate accessors |
| normal/visual | `SPC l s` | generate setter accessor |
| normal/visual | `SPC l g` | generate getter accessor |
| normal/visual | `SPC l a` | generate setter and getter accessor |
| normal | `SPC l M` | generate abstract methods |
| normal | `SPC l g A` | generate accessors |
| normal/visual | `SPC l g s` | generate setter accessor |
| normal/visual | `SPC l g g` | generate getter accessor |
| normal/visual | `SPC l g a` | generate setter and getter accessor |
| normal | `SPC l g M` | generate abstract methods |
| insert | `<c-j>s` | generate setter accessor |
| insert | `<c-j>g` | generate getter accessor |
| insert | `<c-j>a` | generate getter and setter accessor |
| normal | `SPC l ts` | generate toString function |
| normal | `SPC l eq` | generate equals and hashcode function |
| normal | `SPC l c` | generate constructor |
| normal | `SPC l C` | generate default constructor |
| normal | `SPC l g t` | generate toString function |
| normal | `SPC l g e` | generate equals and hashcode function |
| normal | `SPC l g c` | generate constructor |
| normal | `SPC l g C` | generate default constructor |
**Code formatting:**
### Code formatting
the default key bindings for format current buffer is `SPC b f`. and this key bindings is defined in [format layer](<>). you can also use `g=` to indent current buffer.
@ -68,7 +77,7 @@ download [google's formater jar](https://github.com/google/google-java-format)
and add `let g:spacevim_layer_lang_java_formatter = 'path/to/google-java-format.jar'`
to SpaceVim custom configuration file.
#### Maven
### Maven
| Key Binding | Description |
| ----------- | ------------------------------ |
@ -79,12 +88,20 @@ to SpaceVim custom configuration file.
| `SPC l m R` | Run one maven goal |
| `SPC l m t` | Run maven test |
#### Jump
### Jump
| Key Binding | Description |
| ----------- | ---------------------- |
| `SPC l j a` | jump to alternate file |
### Problems buffer
### Inferior REPL process
### Project buffer
Start a `jshell` inferior REPL process with `SPC l s i`.
Send code to inferior process commands:
| Key Binding | Description |
| ----------- | ------------------------------------------------ |
| `SPC l s b` | send buffer and keep code buffer focused |
| `SPC l s l` | send line and keep code buffer focused |
| `SPC l s s` | send selection text and keep code buffer focused |