Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template of SpaceVim's init.toml & init.vim #10

Open
Gabirel opened this issue Apr 13, 2017 · 7 comments
Open

Template of SpaceVim's init.toml & init.vim #10

Gabirel opened this issue Apr 13, 2017 · 7 comments

Comments

@Gabirel
Copy link
Owner

Gabirel commented Apr 13, 2017

This issue is for future use.
location:

  • ~/.SpaceVim.d/init.toml
  • ~/.SpaceVim.d/init.vim(recommended for advanced users)
    NOTE: DO NOT make any changes in ~/.SpaceVim/init.toml or ~/.SpaceVim.d/init.vim.

init.toml could make the source code of SpaceVim dirty so that I personally do not recommend to use it. USE IT AT YOUR OWN RISK!

init.toml

See in: #10 (comment)

init.vim

See in: #10 (comment)

PS: You may want to check my own config file for your convenience: https://github.com/Gabirel/dotfiles/blob/master/.SpaceVim.d/init.vim

@wsdjeg
Copy link

wsdjeg commented Apr 13, 2017

if you want to override some default setting of spacevim, use:

augroup custom_config
    au!
    au VimEnter * call s:customSetting()
augroup END
func s:customSetting()

endf

@Gabirel Gabirel changed the title Template of My SpaceVim config file Template of SpaceVim's config file Apr 13, 2017
@wsdjeg
Copy link

wsdjeg commented Jun 7, 2018

A guide for how to use toml to config spacevim will be better.

https://zhuanlan.zhihu.com/p/36910272

@Gabirel Gabirel changed the title Template of SpaceVim's config file Template of SpaceVim's init.toml & init.vim Aug 28, 2018
@Gabirel
Copy link
Owner Author

Gabirel commented Aug 28, 2018

init.toml (USE IT AT YOUR OWN RISK!)(obsolete)

#=============================================================================
# The detailed example of init.toml for SpaceVim
# Author: Gabirel ( gabrielf977q at gmail.com )
# Date: 2018-08-28
# URL: https://godeep.pro/
#=============================================================================

# All SpaceVim option below [option] section
[options]
  # set spacevim theme. by default colorscheme layer is not loaded,
  # if you want to use more colorscheme, please load the colorscheme
  # layer
  colorscheme = "gruvbox"
  background = "dark"
  # Disable guicolors in basic mode, many terminal do not support 24bit
  # true colors
  enable_guicolors = true
  # Disable statusline separator, if you want to use other value, please
  # install nerd fonts
  statusline_separator = "arrow"
  statusline_inactive_separator = "arrow"
  buffer_index_type = 4
  enable_tabline_filetype_icon = true
  enable_statusline_display_mode = false
  relativenumber = false

# Layers listed in SpaceVim with command: [SPC] h l
######## Function Layers Start ########
#
# Enable autocomplete layer
[[layers]]
  name = 'autocomplete'
  auto-completion-return-key-behavior = "complete"
  auto-completion-tab-key-behavior = "smart"

[[layers]]
  name = "chat"
  enable = false

[[layers]]
  name = "checkers"
  enable = true
  show_cursor_error = true

# Enable Chinese doc layer
[[layers]]
  name = "chinese"
  enable = false

[[layers]]
  name = "colorscheme"
  random-theme = false

[[layers]]
  name = "core#statusline"
  enable = true

[[layers]]
  name = "core#tabline"
  enable = true

# Enable cscope layer
[[layers]]
  name = "cscope"

# Enable ctrlp layer
[[layers]]
  name = "ctrlp"

[[layers]]
  name = "debug"
  enable = false

# Enable yank/paste function
# <Leader> y  => yank to system clipboard
# <Leader> p  => paste from system clipboard
[[layers]]
  name = "default"

# Enable customized Denite centric work-flow
[[layers]]
  name = "denite"
  enable = false

[[layers]]
  name = "exprfold"
  enable = false

# Warning: Only support in neovim
[[layers]]
  name = "floobits"
  enable = false
  
# Warning: You have to install fzf firstly before using it.
[[layers]]
  name = "fzf"
  enable = false

[[layers]]
  name = "games"
  enable = true

[[layers]]
  name = "git"
  enable = true

[[layers]]
  name = "github"
  enable = false

[[layers]]
  name = "incsearch"
  enable = false

[[layers]]
  name = "indentmove"
  enable = false

[[layers]]
  name = "japanese"
  enable = false

# Enable VersionControl layer
[[layers]]
  name = "VersionControl"

[[layers]]
  name = "lsp"
  enable = false
  filetypes = [
    "rust",
    "javascript"
  ]
  [layers.override_cmd]
    rust = ["rustup", "run", "nightly", "rls"]

[[layers]]
  name = "leaderf"
  enable = true

[[layers]]
  name = 'shell'
  # Optional Value: {"top", "bottom", "left", "right", "full"}
  default_position = 'bottom'
  default_height = 30

[[layers]]
  name = "sudo"
  enable = true

# Layer: tags
# Requirements: 
#   - ctags
#   - python-pygments
# More details: https://spacevim.org/layers/tags/
[[layers]]
  name = "tags"
  enable = false

[[layers]]
  name = "tmux"
  enable = false


[[layers]]
  name = "tools#dash"
  enable = false

[[layers]]
  name = "tools"
  enable = true

[[layers]]
  name = "ui"
  enable = true

[[layers]]
  name = "unite"
  enable = false

#
######## Function Layers End   ########


######## Language Layers Start ########
#

[[layers]]
  name = "lang#WebAssembly"
  enable = false

[[layers]]
  name = "lang#agda"
  enable = false

[[layers]]
  name = "lang#autohotkey"
  enable = false

[[layers]]
  name = "lang#c"
  enable = true
  clang_executable = "/usr/bin/clang"
  [layer.clang_std]
    c = "c11"
    cpp = "c++1z"
    objc = "c11"
    objcpp = "c++1z"

# Layer: lang#csharp
# Warning: You must build the `OmniSharp Server` before using this feature.
[[layers]]
  name = "lang#csharp"
  enable = false

# Layer: lang#dart
# Warning: You need to install `dart SDK` before using this feature.
[[layers]]
  name = "lang#dart"
  enable = false

[[layers]]
  name = "lang#dockerfile"
  enable = false

[[layers]]
  name = "lang#elixir"
  enable = false

# Layer: lang#elm
# Warning: See in https://spacevim.org/layers/lang/elm/
# - Requirements: 
#     Elm Platform: http://elm-lang.org/install
# - For unit tests within vim: Install `elm-test`
# - For code completion and doc lookups: Install `elm-oracle`
# - For formatting codes: Install `elm-format`
[[layers]]
  name = "lang#elm"
  enable = false

[[layers]]
  name = "lang#erlang"
  enable = false

# Layer: lang#fsharp
# Warning: You need to install `fsharp` before using this feature.
[[layers]]
  name = "lang#fsharp"
  enable = false

# Layer: lang#go
# Warning: You probably need to install `go-fmt` to enable support for neoformat.
[[layers]]
  name = "lang#go"
  enable = false

[[layers]]
  name = "lang#haskell"
  enable = false

[[layers]]
  name = "lang#html"
  enable = false

[[layers]]
  name = "lang#java"
  enable = false

[[layers]]
  name = "lang#javascript"
  enable = false
  auto_fix = false
  enable_flow_syntax = false

[[layers]]
  name = "lang#julia"
  enable = false

[[layers]]
  name = "lang#kotlin"
  enable = false

# Layer: lang#lisp
# Requirements:
#  - Vim 8.0+ with +channel, or Neovim 0.2.0+ with ncat
#  - ASDF
#  - Quicklisp
#  - An Internet connection to install other dependencies from Quicklisp
[[layers]]
  name = "lang#lisp"
  enable = false

[[layers]]
  name = "lang#lua"
  enable = false

# Layer: lang#markdown
# Formatting: 
# SpaceVim use remark to formatting markdown file, so you need to install this program. you can install it via npm:
# 
#   `npm -g install remark`
#   `npm -g install remark-cli`
#   `npm -g install remark-stringify`
[[layers]]
  name = "lang#markdown"
  enable = true

# Layer: lang#nim
# Warning: You have to install `nim` & `nimble` before using it.
[[layers]]
  name = "lang#nim"
  enable = false

[[layers]]
  name = "lang#ocaml"
  enable = false

[[layers]]
  name = "lang#perl"
  enable = false

# Layer: lang#php
# Requirements:
#   - PHP 5.3+
#   - PCNTL Extension
#   - Msgpack 0.5.7+(for NeoVim) Extension or JSON(for Vim 7.4+) Extension
#   - Composer Project
[[layers]]
  name = "lang#php"
  enable = false

[[layers]]
  name = "lang#plantuml"
  enable = false

# Layer: lang#purescript
# Requirements:
#   - `npm install -g purescript`
#   - `npm install -g pulp bower`
[[layers]]
  name = "lang#purescript"
  enable = false

# Layer: lang#python
# Opthons:
#   Syntax Checking: `pip install --user flake8`
#   Buffer formatting: `pip install --user yapf`
#   Format imports: `pip install --user autoflake`
#   Sort imports: `pip install --user isort`
[[layers]]
  name = "lang#python"
  enable = false

# Layer: lang#ruby
# Opthons:
#   You may want to install `rubocop` for syntax checking and code formatting.
#     `gem install rubocop`
[[layers]]
  name = "lang#ruby"
  enable = false

[[layers]]
  name = "lang#rust"
  enable = false

[[layers]]
  name = "lang#scala"
  enable = false

[[layers]]
  name = "lang#sh"
  enable = true

[[layers]]
  name = "lang#swift"
  enable = false

# Layer: lang#typescript
# Requirements:
#   - `npm install -g typescript`
[[layers]]
  name = "lang#typescript"
  enable = true

#
######## Language Layers End   ########

@Gabirel
Copy link
Owner Author

Gabirel commented Aug 28, 2018

init.vim(Recommended for advanced users)

" ############## Default Setting Start ########################
set wrap
set guifont=JetBrainsMonoForPowerline-Regular:h20
nmap <leader>y "+y
" ############## Default Setting End   ########################


" ############## SpaceVim Setting Start ########################
" basic defualt SpaceVim settings
let g:spacevim_colorscheme  = 'sonokai'
" let g:spacevim_colorscheme  = 'molokai'
let g:spacevim_max_column   = 80
let g:spacevim_default_indent = 4
let g:spacevim_error_symbol = ''
let g:spacevim_warning_symbol =  '!'
let g:spacevim_info_symbol =  'i'
let g:spacevim_buffer_index_type = 4
let g:spacevim_windows_index_type = 1
let g:spacevim_lint_on_the_fly = 0
let g:spacevim_relativenumber = 1
let g:spacevim_filetree_direction = 'left'
let g:spacevim_lint_on_save = 0
let g:spacevim_enable_neomake = 0
let g:spacevim_enable_ale = 1
let g:spacevim_enable_statusline_mode = 1
let g:spacevim_windows_index_type = 3
let g:spacevim_buffer_index_type = 4
let g:spacevim_statusline_separator = 'arrow'
let g:spacevim_autocomplete_method = 'coc'

" core settings: https://github.com/SpaceVim/SpaceVim/pull/4545#issuecomment-1003721728
call SpaceVim#layers#load('core',
    \ {
    \  'enable_smooth_scrolling' : v:true,
    \ }
    \ )

" layers settings
call SpaceVim#layers#load('checkers')
call SpaceVim#layers#load('colorscheme')
call SpaceVim#layers#load('fzf')
"call SpaceVim#layers#load('git')
call SpaceVim#layers#load('VersionControl')
call SpaceVim#layers#load('lang#c')
call SpaceVim#layers#load('lang#javascript')
call SpaceVim#layers#load('lang#latex')
call SpaceVim#layers#load('lang#lua')
call SpaceVim#layers#load('lang#markdown')
call SpaceVim#layers#load('lang#python')
call SpaceVim#layers#load('lang#rust')
call SpaceVim#layers#load('lang#swig')
call SpaceVim#layers#load('lang#xml')
" ############## SpaceVim Setting End  ########################


" ############## Embedded Plugins Setting Start ########################
" {{ coc {{
let g:coc_config_home = '~/.SpaceVim.d/'
let g:coc_global_extensions = [
      \ 'coc-go', 
      \ 'coc-rust-analyzer',
      \ 'coc-sh', 
      \ 'coc-vimlsp',
      \ 'coc-dictionary',
      \ 'coc-word',
      \ 'coc-texlab',
      \ ]

" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)

" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)

" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>

function! s:show_documentation()
  if (index(['vim','help'], &filetype) >= 0)
    execute 'h '.expand('<cword>')
  else
    call CocAction('doHover')
  endif
endfunction

" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')

" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)

" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
  nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
  inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
  inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
  vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif

" Formatting selected code.
" `<leader>f` already taken by SpaceVim 
" xmap <leader>f  <Plug>(coc-format-selected)
" nmap <leader>f  <Plug>(coc-format-selected)
" }} coc }}

" {{ vim_markdown {{
let g:mkdp_path_to_chrome = 'google-chrome-stable'
let g:mkdp_auto_start = 0
let vim_markdown_preview_github=1
let vim_markdown_preview_use_xdg_open=1
" }} vim_markdown }}

" {{ Neoformat {{
" Auto format on save
"augroup fmt
"  autocmd!
"  autocmd BufWritePre * undojoin | Neoformat
"augroup END

let g:neoformat_cpp_clangformat = {
            \ 'exe': 'clang-format',
            \ 'args': ['-style=file'],
            \ 'stdin': 1,
            \ }
" }} Neoformat }}

" {{ ale {{
" setting below is not necessary when dag/vim-fish is enabled
au BufRead,BufNewFile *.fish setfiletype sh
" Disable linting for all fish files.
let g:ale_pattern_options = {'\.fish$': {'ale_enabled': 0}}
" Disable not-so-smart chktex
let g:ale_tex_chktex_executable = ''
"autocmd FileType fish let g:ale_sh_shell_default_shell='fish'
" }} ale }}

" {{ vimtex {{

" If you use Asian language to write latex, you may want these config like I
" do.
" break at a multi-byte character above 255
" check `:help fo-table`
set formatoptions+=m
" no spaces when merge multiple lines of chinese 
" FYI: https://www.reddit.com/r/vim/comments/7566at/how_to_use_set_wrap_for_chinese/
set formatoptions+=B

" Special setting for latex files
" Use `gggqG` to format long lines in Latex
" Use `gq11j` to wrap the line you're on with the 11 below it
" Use `gqip` or `gqap` to wrap the paragraph
" gg(go to first line), gq(format) to G(the last line)
autocmd FileType tex setlocal colorcolumn=80 textwidth=79 tabstop=2 shiftwidth=2 expandtab
nnoremap <leader>v gqip
" See: http://vimdoc.sourceforge.net/htmldoc/syntax.html#g:tex_conceal
" let g:tex_conceal = "abdg"

let g:vimtex_quickfix_enabled = 0

" Disable all syntax conceal
let g:vimtex_syntax_conceal_disable = 1
" Disable automatic view since I use texlab with skim to preview in background
" personally
let g:vimtex_view_enabled = 0
let g:vimtex_view_automatic = 0
" }} vimtex }}
" ############## Embedded Plugins Setting End   ########################


" ############## Extra Plugins Setting Start ########################

" ############## Extra Plugins Setting End   ########################


" ############## Custom Plugins in SpaceVim Start ########################
let g:spacevim_custom_plugins = [
    \ ['machakann/vim-highlightedyank'],
    \ ['iloginow/vim-stylus'],
    \ ['sainnhe/sonokai'],
    \ ['sheerun/vim-polyglot'], 
    \ ]
" ############## Custom Plugins in SpaceVim End   ########################


" ############## Custom Plugins Setting in SpaceVim Start ########################
let g:sonokai_style = 'default'
let g:sonokai_better_performance = 1
let g:indentLine_setConceal = 0 " This is a bug: https://github.com/SpaceVim/SpaceVim/issues/4268
" let g:vim_markdown_conceal = 0
" let g:markdown_syntax_conceal = 0
" set conceallevel=2
" ############## Custom Plugins Setting in SpaceVim End  ########################

@gatspy
Copy link

gatspy commented Sep 16, 2019

how set gvim columns and lines?
换成init.vim作为配置文件,然后增加设置, 用toml文件还真不知道怎么搞.

set columns=140
set lines=40

@gatspy
Copy link

gatspy commented Sep 16, 2019

@Gabirel thank you!
I want to change the size of the window after gvim is opened.

@Gabirel
Copy link
Owner Author

Gabirel commented Sep 16, 2019

@gatspy Try to use bootstrap function for Vim script when you are using init.toml.

Or just use traditional config file: init.vim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants