From a831c151b2631f80a87a5c0728022b3b44d1309f Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sun, 27 Sep 2020 22:49:44 +0800 Subject: [PATCH] Update kotlin doc (#3841) --- .gitignore | 1 + .projections.json | 6 ++ autoload/SpaceVim.vim | 45 +++++++++- autoload/SpaceVim/layers/lang/kotlin.vim | 7 +- doc/SpaceVim.txt | 85 ++++++++++++++----- .../2020-09-24-use-vim-as-a-kotlin-ide.md | 10 ++- .../2020-09-25-use-vim-as-a-kotlin-ide.md | 13 ++- 7 files changed, 141 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 3974e19ab..a611ec1df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +!0/ doc/tags doc/tags-cn .ropeproject/ diff --git a/.projections.json b/.projections.json index b0541e694..224407d73 100644 --- a/.projections.json +++ b/.projections.json @@ -96,5 +96,11 @@ }, "docs/_posts/2019-07-16-Asynchronous-todo-manager.md": { "alternate": "docs/_posts/2019-07-17-Asynchronous-todo-manager.md" + }, + "docs/_posts/2020-09-25-use-vim-as-a-kotlin-ide.md" : { + "alternate": "docs/_posts/2020-09-24-use-vim-as-a-kotlin-ide.md" + }, + "docs/_posts/2020-09-24-use-vim-as-a-kotlin-ide.md" : { + "alternate": "docs/_posts/2020-09-25-use-vim-as-a-kotlin-ide.md" } } diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 163c4f792..ed22177c2 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -1041,14 +1041,55 @@ let g:spacevim_lint_on_save = 1 " 'pt', 'ack', 'grep', 'findstr', 'git'] let g:spacevim_search_tools = ['rg', 'ag', 'pt', 'ack', 'grep', 'findstr', 'git'] "" -" Set the project rooter patterns, by default it is -" `['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/']` +" @section project_rooter_patterns, options-project_rooter_patterns +" @parentsection options +" Set the project root patterns, SpaceVim determines the root directory of the +" project based on this option. By default it is: +" > +" ['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/'] +" < + +"" +" Set the project root patterns, SpaceVim determines the root directory of the +" project based on this option. By default it is: +" > +" ['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/'] +" < let g:spacevim_project_rooter_patterns = ['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/'] +"" +" @section project_rooter_automatically, options-project_rooter_automatically +" @parentsection options +" Enable/Disable project root detection. By default, SpaceVim will change the +" directory to the project root directory based on `project_rooter_patterns` +" option. To disable this feature: +" > +" [options] +" project_rooter_automatically = false +" < + "" " Enable/Disable changing directory automatically. Enabled by default. let g:spacevim_project_rooter_automatically = 1 "" +" @section project_rooter_outermost, options-project_rooter_outermost +" @parentsection options " Enable/Disable finding outermost directory for project root detection. +" By default SpaceVim will find the outermost directory based on +" `project_rooter_patterns`. To find nearest directory, you need to disable +" this option: +" > +" [options] +" project_rooter_outermost = false +" < + +"" +" Enable/Disable finding outermost directory for project root detection. +" By default SpaceVim will find the outermost directory based on +" `project_rooter_patterns`. To find nearest directory, you need to disable +" this option: +" > +" let g:spacevim_project_rooter_outermost = 0 +" < let g:spacevim_project_rooter_outermost = 1 "" diff --git a/autoload/SpaceVim/layers/lang/kotlin.vim b/autoload/SpaceVim/layers/lang/kotlin.vim index 08bbd89e1..4cd6f6700 100644 --- a/autoload/SpaceVim/layers/lang/kotlin.vim +++ b/autoload/SpaceVim/layers/lang/kotlin.vim @@ -64,7 +64,12 @@ function! SpaceVim#layers#lang#kotlin#config() abort \ '%Wwarning: %m,' . \ '%Iinfo: %m,' \ } - let g:neomake_kotlin_enabled_makers = ['kotlinc'] + let g:neomake_kotlin_ktlint_maker = { + \ 'errorformat': '%E%f:%l:%c: %m', + \ } + let g:neomake_kotlin_enabled_makers = ['ktlint'] + let g:neomake_kotlin_kotlinc_remove_invalid_entries = 1 + let g:neomake_kotlin_ktlint_remove_invalid_entries = 1 endif call SpaceVim#mapping#space#regesit_lang_mappings('kotlin', function('s:language_specified_mappings')) if s:enable_native_support diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 84ac75cbc..2000e6523 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -55,24 +55,28 @@ CONTENTS *SpaceVim-contents* 35. max_column.............................|SpaceVim-options-max_column| 36. plugin_bundle_dir...............|SpaceVim-options-plugin_bundle_dir| 37. plugin_manager_processes.|SpaceVim-options-plugin_manager_processes| - 38. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide| - 39. relativenumber.....................|SpaceVim-options-relativenumber| - 40. retry_cnt...............................|SpaceVim-options-retry_cnt| - 41. search_tools.........................|SpaceVim-options-search_tools| - 42. sidebar_width.......................|SpaceVim-options-sidebar_width| - 43. snippet_engine.....................|SpaceVim-options-snippet_engine| - 44. statusline_iseparator.......|SpaceVim-options-statusline_iseparator| - 45. statusline_left_sections.|SpaceVim-options-statusline_left_sections| - 46. statusline_separator.........|SpaceVim-options-statusline_separator| - 47. statusline_unicode_symbols + 38. project_rooter_automatically +...............................|SpaceVim-options-project_rooter_automatically| + 39. project_rooter_outermost.|SpaceVim-options-project_rooter_outermost| + 40. project_rooter_patterns...|SpaceVim-options-project_rooter_patterns| + 41. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide| + 42. relativenumber.....................|SpaceVim-options-relativenumber| + 43. retry_cnt...............................|SpaceVim-options-retry_cnt| + 44. search_tools.........................|SpaceVim-options-search_tools| + 45. sidebar_width.......................|SpaceVim-options-sidebar_width| + 46. snippet_engine.....................|SpaceVim-options-snippet_engine| + 47. statusline_iseparator.......|SpaceVim-options-statusline_iseparator| + 48. statusline_left_sections.|SpaceVim-options-statusline_left_sections| + 49. statusline_separator.........|SpaceVim-options-statusline_separator| + 50. statusline_unicode_symbols .................................|SpaceVim-options-statusline_unicode_symbols| - 48. terminal_cursor_shape.......|SpaceVim-options-terminal_cursor_shape| - 49. vim_help_language...............|SpaceVim-options-vim_help_language| - 50. vimcompatible.......................|SpaceVim-options-vimcompatible| - 51. warning_symbol.....................|SpaceVim-options-warning_symbol| - 52. windows_index_type.............|SpaceVim-options-windows_index_type| - 53. windows_leader.....................|SpaceVim-options-windows_leader| - 54. windows_smartclose.............|SpaceVim-options-windows_smartclose| + 51. terminal_cursor_shape.......|SpaceVim-options-terminal_cursor_shape| + 52. vim_help_language...............|SpaceVim-options-vim_help_language| + 53. vimcompatible.......................|SpaceVim-options-vimcompatible| + 54. warning_symbol.....................|SpaceVim-options-warning_symbol| + 55. windows_index_type.............|SpaceVim-options-windows_index_type| + 56. windows_leader.....................|SpaceVim-options-windows_leader| + 57. windows_smartclose.............|SpaceVim-options-windows_smartclose| 3. Configuration...........................................|SpaceVim-config| 4. Commands..............................................|SpaceVim-commands| 5. Functions............................................|SpaceVim-functions| @@ -518,6 +522,38 @@ PLUGIN_MANAGER_PROCESSES *SpaceVim-options-plugin_manager_processes* Set the max process of SpaceVim plugin manager +============================================================================== +PROJECT_ROOTER_AUTOMATICALLY *SpaceVim-options-project_rooter_automatically* + +Enable/Disable project root detection. By default, SpaceVim will change the +directory to the project root directory based on `project_rooter_patterns` +option. To disable this feature: +> + [options] + project_rooter_automatically = false +< + +============================================================================== +PROJECT_ROOTER_OUTERMOST *SpaceVim-options-project_rooter_outermost* + +Enable/Disable finding outermost directory for project root detection. By +default SpaceVim will find the outermost directory based on +`project_rooter_patterns`. To find nearest directory, you need to disable this +option: +> + [options] + project_rooter_outermost = false +< + +============================================================================== +PROJECT_ROOTER_PATTERNS *SpaceVim-options-project_rooter_patterns* + +Set the project root patterns, SpaceVim determines the root directory of the +project based on this option. By default it is: +> + ['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/'] +< + ============================================================================== REALTIME_LEADER_GUIDE *SpaceVim-options-realtime_leader_guide* @@ -1164,14 +1200,23 @@ Default search tools supported by flygrep. The default order is ['rg', 'ag', 'pt', 'ack', 'grep', 'findstr', 'git'] *g:spacevim_project_rooter_patterns* -Set the project rooter patterns, by default it is `['.git/', '_darcs/', -'.hg/', '.bzr/', '.svn/']` +Set the project root patterns, SpaceVim determines the root directory of the +project based on this option. By default it is: +> + ['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/'] +< *g:spacevim_project_rooter_automatically* Enable/Disable changing directory automatically. Enabled by default. *g:spacevim_project_rooter_outermost* -Enable/Disable finding outermost directory for project root detection. +Enable/Disable finding outermost directory for project root detection. By +default SpaceVim will find the outermost directory based on +`project_rooter_patterns`. To find nearest directory, you need to disable this +option: +> + let g:spacevim_project_rooter_outermost = 0 +< *g:spacevim_commandline_prompt* Config the command line prompt for flygrep and denite etc. diff --git a/docs/_posts/2020-09-24-use-vim-as-a-kotlin-ide.md b/docs/_posts/2020-09-24-use-vim-as-a-kotlin-ide.md index c5a0b9e98..94d59d7c8 100644 --- a/docs/_posts/2020-09-24-use-vim-as-a-kotlin-ide.md +++ b/docs/_posts/2020-09-24-use-vim-as-a-kotlin-ide.md @@ -70,7 +70,15 @@ lsp 模块默认使用 `kotlin-language-server` 作为 Kotlin 的语言服务器 ### 语法检查 `checkers` 模块为 SpaceVim 提供了语法检查的功能,该模块默认已经载入。该模块默认使用 [neomake](https://github.com/neomake/neomake) -这一异步语法检查工具。对于 Kotlin 的支持,是通过异步调用 `kotlinc` 命令来完成的。 +这一异步语法检查工具。对于 Kotlin 的支持,是通过异步调用 [ktlint](https://github.com/pinterest/ktlint) 命令来完成的。 + +在 Window 系统下,可以使用 [scoop](https://github.com/lukesampson/scoop) 安装 ktlint: + +``` +scoop install ktlint +``` + +![kotlin-lint](https://user-images.githubusercontent.com/13142418/94366839-3e846a00-010d-11eb-9e6c-200931646479.png) ### 工程文件跳转 diff --git a/docs/_posts/2020-09-25-use-vim-as-a-kotlin-ide.md b/docs/_posts/2020-09-25-use-vim-as-a-kotlin-ide.md index 575a66ce9..9cc1e2c1c 100644 --- a/docs/_posts/2020-09-25-use-vim-as-a-kotlin-ide.md +++ b/docs/_posts/2020-09-25-use-vim-as-a-kotlin-ide.md @@ -47,8 +47,17 @@ The completion menu will be opened as you type. ### Syntax linting The [checkers](../checkers/) layer is enabled by default. -This layer provides asynchronous syntax linting via [neomake](https://github.com/neomake/neomake). -It will run `kotlinc` asynchronously. +This layer provides asynchronous syntax linting for kotlin. +The default plugin is [neomake](https://github.com/neomake/neomake), +and the default lint command is [ktlint](https://github.com/pinterest/ktlint). + +In the Windows system, `ktlint` can be installed using [scoop](https://github.com/lukesampson/scoop): + +``` +scoop install ktlint +``` + +![kotlin-lint](https://user-images.githubusercontent.com/13142418/94366839-3e846a00-010d-11eb-9e6c-200931646479.png) ### Jump to test file