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

Make space-vim able to be installed to location other than ~/.space-vim #485

Merged
merged 3 commits into from
Sep 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ Thumbs.db

tags

autoload/plug.vim
core/autoload/info.vim
core/autoload/spacevim/info.vim
plugged/*
*.un~
private/*
!private/README.md
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
PWD := $(shell pwd)
APP := space-vim
INIT_VIM := ~/.space-vim/init.vim
INIT_VIM := $(PWD)/init.vim
VIMRC := ~/.vimrc
NVIMRC := ~/.config/nvim/init.vim

INIT_SPACEVIM := ~/.space-vim/init.spacevim
INIT_SPACEVIM := $(PWD)/init.spacevim
DOT_SPACEVIM := ~/.spacevim

help:
Expand Down Expand Up @@ -39,7 +40,6 @@ uninstall:
rm -f $(VIMRC) && echo " - Removed $(VIMRC)"; \
rm -f $(NVIMRC) && echo " - Removed $(NVIMRC)"; \
rm -f $(DOT_SPACEVIM) && echo " - Removed $(DOT_SPACEVIM)"; \
rm -rf ~/.$(APP) && echo " - Removed ~/.$(APP)"; \
echo -e "\033[32m[✔]\033[0m Successfully uninstalled $(APP)"

.PHONY: help vim neovim update uninstall
35 changes: 22 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ $ bash <(curl -fsSL https://raw.githubusercontent.com/liuchengxu/space-vim/maste
#### Makefile

```bash
$ git clone https://github.com/liuchengxu/space-vim.git ~/.space-vim
$ cd ~/.space-vim
$ git clone https://github.com/liuchengxu/space-vim.git /path/to/space-vim
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking about if it could be better for the consistency favor to use a environment variable for space-vim location at all the places, like

$ export SPACE_VIM_LOCATION=/custom-path
$ git clone https://github.com/liuchengxu/space-vim.git "$SPACE_VIM_LOCATION/space-vim"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I apologize I didn't respond yet while I thought about it. While an environmental variable could be used in the installation directions I don't think it necessary.

I'd seen the /path/to/git-repository installation pattern used in this project:

git clone https://github.com/ingydotnet/git-subrepo /path/to/git-subrepo
echo 'source /path/to/git-subrepo/.rc' >> ~/.bashrc

Interesting and simple pattern.

$ cd /path/to/space-vim
$ make vim # install space-vim for Vim
$ make neovim # install space-vim for NeoVim
```
Expand All @@ -123,31 +123,40 @@ The easist way is to download [`install.cmd`](https://raw.githubusercontent.com/

Given git and Vim/NeoVim have been installed already:

1. Clone [space-vim](https://github.com/liuchengxu/space-vim)
1. Clone [space-vim](https://github.com/liuchengxu/space-vim):

/path/to/space-vim may be ~/.vim or ~/.config/nvіm if you so desire.
liuchengxu marked this conversation as resolved.
Show resolved Hide resolved

```bash
$ git clone https://github.com/liuchengxu/space-vim.git ~/.space-vim
$ git clone https://github.com/liuchengxu/space-vim.git /path/to/space-vim
```

2. Install [vim-plug](https://github.com/junegunn/vim-plug#installation), refer to vim-plug installation section for more information.
2. Install [vim-plug](https://github.com/junegunn/vim-plug#installation), refer to vim-plug installation section for more information:
```bash
# For Vim
$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
liuchengxu marked this conversation as resolved.
Show resolved Hide resolved
# For NeoVim
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
```

3. Create the symlinks.
3. Create the symlinks and install plugins:

**Linux and macOS**

```bash
# For Vim
$ ln -s ~/.space-vim/init.vim ~/.vimrc
$ ln -s /path/to/space-vim/init.vim ~/.vimrc
$ cp /path/to/space-vim/init.spacevim ~/.spacevim
$ vim -es +'PlugInstall' +qall

# For NeoVim
$ ln -s ~/.space-vim/init.vim ~/.config/nvim/init.vim

# Both for Vim and NeoVim
$ cp ~/.space-vim/init.spacevim ~/.spacevim
$ ln -s /path/to/space-vim/init.vim ~/.config/nvim/init.vim
$ cp /path/to/space-vim/init.spacevim ~/.spacevim
$ nvim +'PlugInstall' +qall
```

5. Open vim, then space-vim will automatically detect and install the missing plugins. 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.
Expand Down
2 changes: 1 addition & 1 deletion core/autoload/spacevim/autocmd/unite.vim
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ let s:menus.v = {
\}
let s:menus.v.command_candidates = [
\['► init.vim',
\'e ~/.vimrc'],
\'e '.g:spacevim.base.'/init.vim'],
\['► .spacevim',
\'e ~/.spacevim'],
\['► vim-help',
Expand Down
2 changes: 1 addition & 1 deletion core/autoload/spacevim/map/manager.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let s:clap_enabled = get(g:, 'spacevim_enable_clap', 0)

let g:spacevim#map#manager#quick_open = [
\ '~/.spacevim',
\ '~/.space-vim/init.vim',
\ g:spacevim.base.'/init.vim',
\ '~/.bashrc',
\ '~/.zshrc',
\ '~/.tmux.conf',
Expand Down
4 changes: 2 additions & 2 deletions init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
scriptencoding utf-8

let g:spacevim = get(g:, 'spacevim', {})
let g:spacevim.base = $HOME.'/.space-vim'
let g:spacevim.base = fnamemodify(resolve(expand('<sfile>:p')),':h')
let g:spacevim.version = '0.9.0'

" Identify platform {
Expand All @@ -35,6 +35,6 @@ if g:spacevim.os.windows
endif
" }

set runtimepath+=$HOME/.space-vim/core
let &runtimepath = &runtimepath . ',' . g:spacevim.base . '/core'

call spacevim#bootstrap()
2 changes: 1 addition & 1 deletion layers/+tools/lsp/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function! s:lcn() abort
let g:LanguageClient_loggingFile = '/tmp/LanguageClient.log'
let g:LanguageClient_loggingLevel = 'INFO'
let g:LanguageClient_serverStderr = '/tmp/LanguageServer.log'
let g:LanguageClient_settingsPath = expand('~/.space-vim/layers/+tools/lsp/settings.json')
let g:LanguageClient_settingsPath = fnamemodify(resolve(expand('<sfile>:p')),':h').'/settings.json'

let g:LanguageClient_serverCommands = {
\ 'c': ['ccls', '--log-file=/tmp/cq.log'],
Expand Down