Skip to content

Commit

Permalink
🍺 Revamped install script; Color picker and toggle plugins added
Browse files Browse the repository at this point in the history
  • Loading branch information
Optixal committed Nov 4, 2017
1 parent 0cbad91 commit 666bccc
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 42 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
/plugged
plugged/
env/
65 changes: 45 additions & 20 deletions README.md
Expand Up @@ -16,53 +16,76 @@ Multi-windowed editing with NerdTree and TagBar sidebars.

### Install

```sh
# Install nvim (and its dependencies: pip3, git) and ctags (for tagbar)
sudo apt install neovim python3-pip git exuberant-ctags -y
#### Automated Installation

# Install pip modules for Neovim
pip3 install --user neovim jedi psutil setproctitle
Run `./install.sh`

# Install vim-plug plugin manager
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
#### Manual Installation

```sh
# Make config directory for Neovim's init.vim
mkdir -p ~/.config/nvim

# Soft link the init.vim in current working directory to nvim's config location. Or simply `cp init.vim ~/.config/nvim/`
ln -sf $(readlink -f init.vim) ~/.config/nvim/.
# Copy init.vim in current working directory to nvim's config location. Alternatively, soft link with `ln -sf $(readlink -f init.vim) ~/.config/nvim/.`, if you soft link, do not delete this directory
cp init.vim ~/.config/nvim/

# Install nvim (and its dependencies: pip3, git), Python 3 and ctags (for tagbar)
sudo apt install neovim python3 python3-pip git exuberant-ctags -y

# Install virtualenv to containerize dependencies
pip3 install --user virtualenv
python3 -m virtualenv ~/.config/nvim/env

# Install pip modules for Neovim within the virtual environment created
source ~/.config/nvim/env/bin/activate
pip install neovim jedi psutil setproctitle
deactivate

# Install vim-plug plugin manager
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

# (Optional but recommended) Install a nerd font for icons and a beautiful airline bar (https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts) (I'll be using Roboto Mono for Powerline)
curl -fLo ~/.local/share/fonts/Roboto\ Mono\ Nerd\ Font\ Complete.ttf --create-dirs https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/RobotoMono/complete/Roboto%20Mono%20Nerd%20Font%20Complete.ttf

# (Optional) Alias vim -> nvim
echo "alias vim='nvim'" >> ~/.bashrc

# Enter Neovim and install plugins
# Enter Neovim and install plugins, ignore warnings shown (missing colorschemes, functions, etc.), simply keep press ENTER
nvim
:PlugInstall
:qa! # Quit All Force (no save). Useful when dealing with multiple split windows.
:qa! # Quit (q) All (a) Force (!) (does not save). Useful when dealing with multiple split windows.
```

Alternatively, run `./install.sh`.

### Update

```sh
# (Optional) Pull my updates if you want my new modifications
git pull
Update plugins (super simple)

# Update the plugins (super simple)
```
nvim
:PlugUpdate
```

# (Optional) Clean plugins - Deletes unused plugins
(Optional) Clean plugins - Deletes unused plugins

```
nvim
:PlugClean
```

# (Optional) Check, download and install the latest vim-plug updates
(Optional) Check, download and install the latest vim-plug

```
nvim
:PlugUpgrade
```

(Optional) Pull my updates if you want my new modifications

```sh
git pull
cp init.vim ~/.config/nvim/
```

## Note

### For Non-GUI Users
Expand Down Expand Up @@ -93,10 +116,12 @@ Most custom commands expand off my map leader, keeping nvim as vanilla as possib
* `,f` - Fuzzy find a file (fzf)
* `,g` - Toggle Goyo mode (Goyo), super clean and minimalistic viewing mode
* `,h` - Toggle rainbow parentheses highlighting
* `,l` - Toggle Limelight mode (Limelight), highlight the lines near cursor only
* `,j` - Set filetype to "journal" which makes the syntax highlighting beautiful when working on regular text files and markdown
* `,k` - Toggle coloring of hex colors
* `,l` - Toggle Limelight mode (Limelight), highlight the lines near cursor only
* `,n` - Hackernews vertical windows (requires internet) (vim-hackernews)
* `,c<Space>` - Toggle comment for current line (Nerd Commenter)
* `<Alt-r>` - Toggle RGB color picker
* `<Tab>` - Next buffer
* `<Shift-Tab>` - Previous buffer

Expand Down
40 changes: 40 additions & 0 deletions init.vim
Expand Up @@ -38,6 +38,8 @@ Plug 'Yggdroot/indentLine'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'sheerun/vim-polyglot'
Plug 'KabbAmine/vCoolor.vim'
Plug 'chrisbra/Colorizer'
Plug 'heavenshell/vim-pydocstring'
Plug 'vim-scripts/loremipsum'

Expand All @@ -46,6 +48,9 @@ Plug 'ryanss/vim-hackernews'

call plug#end()

""" Python3 VirtualEnv
let g:python3_host_prog = expand('~/.config/nvim/env/bin/python')

""" Coloring
syntax on
color dracula
Expand Down Expand Up @@ -198,10 +203,45 @@ nmap <leader>f :Files<CR>
nmap <leader>g :Goyo<CR>
nmap <leader>h :RainbowParentheses!!<CR>
nmap <leader>j :set filetype=journal<CR>
nmap <leader>k :ColorToggle<CR>
nmap <leader>l :Limelight!!<CR>
xmap <leader>l :Limelight!!<CR>
autocmd FileType python nmap <leader>x :0,$!python3 -m yapf<CR>
nmap <leader>n <C-w>v<C-w>l:HackerNews best<CR>J
nmap <silent> <leader><leader> :noh<CR>
nmap <Tab> :bnext<CR>
nmap <S-Tab> :bprevious<CR>
nmap <buffer> <silent> <expr> <F12> InsertCol()
imap <buffer> <silent> <expr> <F12> InsertCol()
function! InsertCol()
let w:first_call = exists('w:first_call') ? 0 : 1
"if w:first_call
" startinsert
"endif
try
let char = getchar()
catch /^Vim:Interrupt$/
let char = "\<Esc>"
endtry
if char == '^\d\+$' || type(char) == 0
let char = nr2char(char)
endif " It is the ascii code.
if char == "\<Esc>"
unlet w:first_call
return char
endif
redraw
if w:first_call
return char."\<Esc>gvA\<C-R>=Redraw()\<CR>\<F12>"
else
return char."\<Esc>gvlA\<C-R>=Redraw()\<CR>\<F12>"
endif
endfunction

function! Redraw()
redraw
return ''
endfunction

53 changes: 32 additions & 21 deletions install.sh
@@ -1,34 +1,45 @@
#!/bin/bash

# Install nvim (and its dependencies: pip3, git) and ctags (for tagbar)
echo '[*] App installing Neovim and its dependencies (Python 3 and git), and dependencies for tagbar (exuberant-ctags) ...'
sudo apt install neovim python3-pip git exuberant-ctags -y &&\
# Make config directory for Neovim's init.vim
echo '[*] Preparing Neovim config directory ...' &&\
mkdir -p ~/.config/nvim &&\

# Install pip modules for Neovim
echo '[*] Pip installing Neovim (for Python plugin support) and libraries for async autocompletion support (jedi, psutil, setproctitle) ...'
pip3 install --user neovim jedi psutil setproctitle &&\
# Install nvim (and its dependencies: pip3, git), Python 3 and ctags (for tagbar)
echo '[*] App installing Neovim and its dependencies (Python 3 and git), and dependencies for tagbar (exuberant-ctags) ...' &&\
sudo apt install neovim python3 python3-pip git exuberant-ctags -y &&\

# Install vim-plug plugin manager
echo '[*] Downloading vim-plug, the best minimalistic vim plugin manager ...'
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim &&\
# Install virtualenv to containerize dependencies
echo '[*] Pip installing virtualenv to containerize Neovim dependencies (instead of installing them onto your system) ...' &&\
pip3 install --user virtualenv &&\
python3 -m virtualenv ~/.config/nvim/env &&\

# Make config directory for Neovim's init.vim
echo '[*] Preparing Neovim config directory ...'
mkdir -p ~/.config/nvim &&\
# Install pip modules for Neovim within the virtual environment created
echo '[*] Activating virtualenv and pip installing Neovim (for Python plugin support) and libraries for async autocompletion support (jedi, psutil, setproctitle) ...' &&\
source ~/.config/nvim/env/bin/activate &&\
pip install neovim jedi psutil setproctitle &&\
deactivate &&\

# Soft link the init.vim in current working directory to nvim's config location. Or simply `cp init.vim ~/.config/nvim/`
echo "[*] Soft-linking $(readlink -f init.vim) -> $(readlink -f ~/.config/nvim/init.vim)"
ln -sf $(readlink -f init.vim) ~/.config/nvim/. &&\
# Install vim-plug plugin manager
echo '[*] Downloading vim-plug, the best minimalistic vim plugin manager ...' &&\
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim &&\

# (Optional but recommended) Install a nerd font for icons and a beautiful airline bar (https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts) (I'll be using Roboto Mono for Powerline)
echo "[*] Downloading patch font into ~/.local/share/fonts ..."
echo "[*] Downloading patch font into ~/.local/share/fonts ..." &&\
curl -fLo ~/.local/share/fonts/Roboto\ Mono\ Nerd\ Font\ Complete.ttf --create-dirs https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/RobotoMono/complete/Roboto%20Mono%20Nerd%20Font%20Complete.ttf &&\

# (Optional) Alias vim -> nvim
echo '[*] Aliasing vim -> nvim, remember to source ~/.bashrc ...'
echo '[*] Aliasing vim -> nvim, remember to source ~/.bashrc ...' &&\
echo "alias vim='nvim'" >> ~/.bashrc &&\

# Enter Neovim and install plugins
echo '[*] Running :PlugInstall within nvim.'
nvim -c ':PlugInstall'
echo "[+] Done, enjoy Neovim! Don't forget to run :PlugInstall within nvim."
# Enter Neovim and install plugins using a temporary init.vim, which avoids warnings about missing colorschemes, functions, etc
echo -e '[*] Running :PlugInstall within nvim ...' &&\
sed '/call plug#end/q' init.vim > ~/.config/nvim/init.vim &&\
nvim -c ':PlugInstall' -c ':qall' &&\
rm ~/.config/nvim/init.vim &&\

# Copy init.vim in current working directory to nvim's config location ...`
echo '[*] Copying init.vim -> ~/.config/nvim/init.vim' &&\
cp init.vim ~/.config/nvim/ &&\

echo -e "[+] Done, welcome to \033[1m\033[92mNeoVim\033[0m! Try it by running: nvim/vim. Want to customize it? Modify ~/.config/nvim/init.vim"

0 comments on commit 666bccc

Please sign in to comment.