Giter Site home page Giter Site logo

fangj99 / space-vim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liuchengxu/space-vim

0.0 2.0 0.0 18.28 MB

:seedling: An elegant vim distribution inspired by spacemacs

Home Page: http://www.liuchengxu.org/space-vim/org/tutorial_cn.html

License: MIT License

Vim Script 87.50% Shell 5.20% Python 7.30%

space-vim's Introduction

badge license Build Status


space-vim

前言 | 运行截图 | 适用人群 | 开始使用 | 个性化 | 更新 | 默认安装 | 基础键位 | 使用建议

Table of Contents

Introduction

space-vim is a vim distribution for vim plugins and resources, compatible with Vim and NeoVim.

It is inspired by spacemacs and mimics spacemacs in a high level, especially in the whole architecture, key bindings and GUI. if have ever tried spacemacs, you will find space-vim is very similar to it in user experience.

Elegance here means pleasing, graceful as well as simple. If you are unfamiliar with spacemacs, you can visit spacemacs.org for more about the priciple behind that, which is also what space-vim seeks.

The distribution is completely customizable using .spacevim, which is equivalent to .spacemacs in spacemacs.

screenshot (Terminal vim with space-vim-dark theme)

Features

  • Beautiful interface: I have also written a vim colorscheme space-vim-dark based on spacemacs-dark theme. You could also try spacemacs-theme.vim, which looks nice in GUI vim.

    screenshot (Terminal vim with set termguicolors)

  • Mnemonic key bindings: commands have mnemonic prefixes like SPC b for all the buffer commands.

    Meanwhile, the whole key bindings have been well adapted for vim for the lack of great plugins similar to which-key in emacs. Most key bindings are limited to no more than two keystrokes without counting <Leader> or <LocalLeader> in, e.g. SPC x d to delete trailing whitespaces.

    For different language layers, <LocalLeader>, , as default in space-vim, can be seen as the major-mode prefix in spacemacs.

For whom?

  • the novice vim users
  • the vimmers who pursuit a beautiful appearance
  • the users using both vim and spacemacs

If you have been a vimmer for quite a while, just pick out the part you are interested in. space-vim is well-organized due to the layers concept, you can easily find what you want.

Install

You have to satisfy some prerequisites at first:

  • vim with +python or +python3 feature.

    If :echo has('python') or :echo has('python3') returns 1, then you are done. What's more, the most recent vim version is recommended.

  • git.

When layers enabled at the first time, you need to run :PlugInstall to install relevant plugins.

Linux and macOS

  • curl

    sh -c "$(curl -fsSL https://raw.githubusercontent.com/liuchengxu/space-vim/master/install.sh)"
  • wget

    sh -c "$(wget -qO- https://raw.githubusercontent.com/liuchengxu/space-vim/master/install.sh)"

    ⚠️ For neovim, after the quick installer is done, you still need to create a symlink:

    ln -s ~/.space-vim/init.vim ~/.config/nvim/init.vim

Windows(experimental)

  1. Download git

  2. Download Vim and Python

  3. Download vim-plug:

    windows (PowerShell)

    md ~\.vim\autoload
    $uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
    (New-Object Net.WebClient).DownloadFile($uri, $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("~\.vim\autoload\plug.vim"))
  4. Enter your home directory, Open Git Bash by right-clicking and choosing the option Git Bash Here. Run the following commands to download space-vim and make a symlink.

    git clone https://github.com/liuchengxu/space-vim.git ~/.space-vim
    ln -s ~/.space-vim/init.vim ~/.vimrc
  5. Create .spacevim in home directory.

    function! Layers()
        Layer 'fzf'
        Layer 'unite'
        Layer 'better-defaults'
        " For chinese users
        Layer 'chinese'
    endfunction
    
    function! UserInit()
    endfunction
    
    function! UserConfig()
    endfunction
  6. Open vim, run :PlugInstall.

Manual (Linux and macOS)

  1. Clone space-vim

    git clone https://github.com/liuchengxu/space-vim.git ~/.space-vim
  2. Install vim-plug, refer to vim-plug installation section for more information.

  3. Create a symlink.

    # for vim
    ln -s ~/.space-vim/init.vim ~/.vimrc
    
    # for neovim
    ln -s ~/.space-vim/init.vim ~/.config/nvim/init.vim
  4. (Optional) Install the Source Code Pro or Powerline font.

    If you are running in terminal you'll need to change font settings of your terminal as well.

    iterm2_font_setting

  5. Open vim, then space-vim will automatically install the missing plugins in enabled layers. If auto-installation fails unexpectly, please try running :PlugInstall manually.

Customize

You can use .spacevim in your home directory to customize space-vim, where you can enable the existing layers, add your extra plugins and private configurations.

If .spacevim does not exist, none of the vim configurations will be loaded!

" You can enable the existing layers in space-vim and
" exclude the partial plugins in a certain layer.
" The command Layer and Exlcude are vaild in the function Layers().
function! Layers()

    " Default layers, recommended!
    Layer 'fzf'
    Layer 'unite'
    Layer 'better-defaults'

endfunction

" Put your private plugins here, e.g., change the colorscheme.
function! UserInit()

    " Space has been set as the default leader key,
    " Comma has been set at the default localleader key.
    " If you want to change it, uncomment and set it here.
    " let g:spacevim_leader = "your leader key"
    " let g:spacevim_localleader = 'your localleader key'

    " Install private plugins
    Plug 'morhetz/gruvbox'

endfunction

" Override the existing configurations and add extras here.
function! UserConfig()

    " color gruvbox

endfunction

If you want to use GUI color in terminal vim, add this to UserConfig():

set termguicolors
" If you use vim inside tmux, see https://github.com/vim/vim/issues/993
" set Vim-specific sequences for RGB colors
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"

For more details about true colour, please see the gist TrueColour.md.

If have a heavy customized configuration, you can organize them in private directory with packages.vim and config.vim too, which will be loaded on startup. The private directory can be considered as either a single layer, i.e., in which you can put packages.vim and config.vim, or a set of multiple layers.

How to use

If you want to know more about the bootstrap of space-vim, please see wiki.

I recommend you to look through the existing key bindings via SPC ?. What's more, you definitely can not miss reading the README of better-defaults layer, which is of great importance for you to get started quickly.

For more information, please refer to the README under the certain layer enabled, or you can see config.vim and packages.vim directly.

If the README is not elaborate, sorry for that, space-vim now is in the early stages and a ton of stuff are waiting to be done.

Update

The simplest way to update is to reinstall it completely by rerunning the installer above. It will non-destructively upgrade to the latest version.

Alternatively, you can manually perform the following steps. If anything has changed with the structure of the configuration, you will have to create the appropriate symlinks.

cd path/to/space-vim/
git pull origin master

FAQ

Q: Why develop this?

A: I was amazed by spacemacs' beautiful GUI and mnemonic key bindings when using it at the first time. Now I often use spacemacs when in GUI environment. But in the terminal, vim is definitely my first choice. Then I hope to maintain consistency in operation as much as possible in either scenario. Hence I try to reconfigure the vim based on spacemacs' architecture, especially in key bindings and GUI. This is space-vim at present.

Q: How do you think of spacemacs, space-vim as well as some other vim configurations/distributions derived from spacemacs?

A: Spacemacs' popularity indeed benefits a great number of people, making remarkable contributions to the community. I truly appreciate @syl20bnr and the whole contributors' outstanding works and have learnt many lessons from spacemacs.

For space-vim, it was merely a personal vim configuration for the purpose of convenience of users using vim and spacemacs at the same time. I am glad that some people like it and give many suggestions to improve it.

If you like space-vim and are willing to polish it, feel free to give any pieces of advice. However, it doesn't mean that I am positive on spending extra time joining some organization focusing on making a spacemacs-like vim distribution. I don't have enough time to maintain or contribute to another similar vim distribution.

It is encouraged to fork space-vim to build up your own personalized vim configuration. It's an open source project, you can turn it into any shape you like.

Contributions

If you encounter any problem or have any suggestions, please open an issue or send a PR.

Space-vim is still in beta. If you are interested, contributions are highly welcome.

Acknowledgements

I would like to thank the many people who have helped and contributed to this project. Furthermore, space-vim will never born without the following outstanding open source projects.

Articles

space-vim's People

Contributors

liuchengxu avatar yesmeck avatar chenge avatar zer4tul avatar tracyone avatar fno2010 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.