Skip to content

Commit 3f0bca1

Browse files
committedJun 24, 2021
Revamped with new plugins and fixes, including CoC, transparent terminal support, and much more
1 parent 6580181 commit 3f0bca1

File tree

5 files changed

+235
-127
lines changed

5 files changed

+235
-127
lines changed
 

‎.tmux.conf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Vim compatability
2+
set -sg escape-time 5 # fix vim esc delay
3+
set -g default-terminal "screen-256color" # ensures vim uses right $TERM color, default is "screen"
4+
set -ga terminal-overrides ",*256col*:Tc" # fixes vim reproducing slightly wrong colors in tmux

‎README.md

+42-65
Original file line numberDiff line numberDiff line change
@@ -18,92 +18,67 @@ Multi-windowed editing with NerdTree and TagBar sidebars.
1818

1919
#### Automated Installation
2020

21-
Run `./install.sh`
21+
`./install.sh`
2222

23-
#### Manual Installation
23+
Automatically installs my configuration, along with dependencies into your system. Tested on Ubuntu 20.04. I highly suggest reading and understanding each line of the installation script before running it, especially if you are using other Linux distros, or macOS. For macOS, manually run the commands, and use `homebrew` instead of `apt`.
2424

25-
```sh
26-
#!/bin/bash -e
25+
#### Post Installation
2726

28-
# Make config directory for Neovim's init.vim
29-
mkdir -p ~/.config/nvim
27+
##### Download and install a Nerd Font
3028

31-
# Install nvim (and its dependencies: pip3, git), Python 3 and ctags (for tagbar)
32-
sudo apt update
33-
sudo apt install neovim python3 python3-pip git curl exuberant-ctags -y
29+
Airline and devicons require a patched font, or Nerd Font in order to display properly. Run `./font_install.sh` to download and install Iosevka Term Nerd Font into your `~/.fonts` directory, or run the command manually:
3430

35-
# Install virtualenv to containerize dependencies
36-
python3 -m pip install virtualenv
37-
python3 -m virtualenv -p python3 ~/.config/nvim/env
31+
```sh
32+
curl -fLo ~/.fonts/Iosevka\ Term\ Nerd\ Font\ Complete.ttf --create-dirs https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Iosevka/Regular/complete/Iosevka%20Term%20Nerd%20Font%20Complete.ttf
33+
```
3834

39-
# Install pip modules for Neovim within the virtual environment created
40-
source ~/.config/nvim/env/bin/activate
41-
pip install neovim==0.2.6 jedi psutil setproctitle yapf
42-
deactivate
35+
Once downloaded, open your terminal's preferences and change the font to "Iosevka Term Regular". If the font is not there, your OS' font directory may not be `~/.fonts`. Find out which directory your fonts are stored in, and place the downloaded font file in that directory instead.
4336

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

47-
# (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 Iosevka for Powerline)
48-
curl -fLo ~/.fonts/Iosevka\ Term\ Nerd\ Font\ Complete.ttf --create-dirs https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Iosevka/Regular/complete/Iosevka%20Term%20Nerd%20Font%20Complete.ttf
39+
It may be easier for you to type `vim` instead of `nvim` everytime you edit a file, so aliasing it could save you some trouble. Add an alias to your bashrc/zshrc/somerc or aliases file to alias nvim to vim:
4940

50-
# (Optional) Alias vim -> nvim
41+
```sh
5142
echo "alias vim='nvim'" >> ~/.bashrc
52-
53-
# Enter Neovim and install plugins using a temporary init.vim, which avoids warnings about missing colorschemes, functions, etc
54-
sed '/call plug#end/q' init.vim > ~/.config/nvim/init.vim
55-
nvim -c ':PlugInstall' -c ':UpdateRemotePlugins' -c ':qall'
56-
rm ~/.config/nvim/init.vim
57-
58-
# Copy init.vim in current working directory to nvim's config location ...
59-
cp init.vim ~/.config/nvim/
6043
```
6144

62-
### Update
45+
##### Fix nvim + tmux issues
6346

64-
Update plugins (super simple)
47+
Running nvim within a tmux session may cause certain unwanted issues like escape key lag, or displaying wrong colors. Run `cat .tmux.conf >> ~/.tmux.conf` or manually add these to your `~/.tmux.conf` configuration file to address the issues:
6548

66-
```
67-
nvim
68-
:PlugUpdate
69-
```
70-
71-
(Optional) Clean plugins - Deletes unused plugins
72-
73-
```
74-
nvim
75-
:PlugClean
49+
```sh
50+
set -sg escape-time 5 # fix vim esc delay
51+
set -g default-terminal "screen-256color" # ensures vim uses right $TERM color, default is "screen"
52+
set -ga terminal-overrides ",*256col*:Tc" # fixes vim reproducing slightly wrong colors in tmux
7653
```
7754

78-
(Optional) Check, download and install the latest vim-plug
55+
### Update
7956

80-
```
81-
nvim
82-
:PlugUpgrade
83-
```
57+
#### Updates from me
8458

85-
(Optional) Pull my updates if you want my new modifications
59+
I occasionally update and push my new configurations here. If you want to receive the updates, you can pull the latest init.vim and replace the one you have.
8660

8761
```sh
8862
git pull
8963
cp init.vim ~/.config/nvim/
9064
```
9165

92-
## Note
66+
#### vim-plug commands for plugins
9367

94-
### For Non-GUI Users
68+
Run these to install new plugins, update or delete existing plugins, or upgrade vim-plug itself.
9569

96-
* Colorschemes may not be rendered
97-
* Changing fonts may be harder (https://unix.stackexchange.com/a/49823), if you do not intend to do customize your font, you should uncomment the devicons plugin within "init.vim" (`" Plug 'ryanoasis/vim-devicons'`)
70+
* Install plugins: `:PlugInstall` in nvim
71+
* Update plugins: `:PlugUpdate` in nvim
72+
* Delete unused plugins: `:PlugClean` in nvim
73+
* Update vim-plug itself: `:PlugUpgrade` in nvim
9874

9975
### Mapped Commands in Normal Mode
10076

10177
Most custom commands expand off my map leader, keeping nvim as vanilla as possible.
10278

10379
* `,` - Map leader, nearly all my custom mappings starts with pressing the comma key
104-
* `,q` - Sidebar filetree viewer (NERDTree)
105-
* `,w` - Sidebar classes, functions, variables list (TagBar)
106-
* `\` - Toggle both NERDTree and TagBar
80+
* `,q` or `\` - Toggle sidebar filetree viewer (NERDTree)
81+
* `,w` or `|` - Toggle sidebar classes, functions, variables list (TagBar)
10782
* `,ee` - Change colorscheme (with fzf fuzzy finder)
10883
* `,ea` - Change Airline theme
10984
* `,e1` - Color mode: Dracula (Dark)
@@ -112,20 +87,22 @@ Most custom commands expand off my map leader, keeping nvim as vanilla as possib
11287
* `,e4` - Color mode: Zazen (Black & White)
11388
* `,r` - Refresh/source ~/.config/nvim/init.vim
11489
* `,t` - Trim all trailing whitespaces
90+
* `,y` - Opens HackerNews in a new vertical split window (vim-hackernews)
91+
* `,p` - Automatically generate Python docstrings while cursor is hovering above a Python function or class (vim-pydocstring)
11592
* `,a` - Auto align variables (vim-easy-align), eg. do `,a=` while your cursor is on a bunch of variables to align their equal signs
116-
* `,s` - New terminal in horizontal split
117-
* `,vs` - New terminal in vertical split
118-
* `,d` - Automatically generate Python docstrings while cursor is hovering above a function or class
119-
* `,f` - Fuzzy find a file (fzf)
120-
* `,g` - Toggle Goyo mode (Goyo), super clean and minimalistic viewing mode
121-
* `,h` - Toggle rainbow parentheses highlighting
93+
* `,s` - Fuzzy find for a string in your current working directory (fzf)
94+
* `,d` - Fuzzy find a file (fzf)
95+
* `,f` - Fuzzy find for a string in the current file/buffer (fzf)
96+
* `,g` - Toggle Goyo mode, super clean and minimalistic display mode (Goyo)
97+
* `,h` - Toggle rainbow parentheses highlighting (rainbow-parentheses.vim)
12298
* `,j` - Set filetype to "journal" which makes the syntax highlighting beautiful when working on regular text files and markdown
12399
* `,k` - Toggle coloring of hex colors
124-
* `,l` - Toggle Limelight mode (Limelight), highlight the lines near cursor only
100+
* `,l` - Toggle Limelight mode, highlight the lines near cursor only (Limelight)
101+
* `,x` - Auto format Python scripts (yapf)
102+
* `,,` - Remove highlights
125103
* `,c<Space>` - Toggle comment for current line (Nerd Commenter)
126-
* `<Alt-r>` - Toggle RGB color picker
104+
* `,$s` - New terminal in horizontal split
105+
* `,$v` - New terminal in vertical split
106+
* `<Alt-r/c>` - Toggle RGB color picker (vCoolor) (uses GTK+, requires yad or zenity)
127107
* `<Tab>` - Next buffer
128108
* `<Shift-Tab>` - Previous buffer
129-
130-
More commmands at https://github.com/Optixal/.vim/blob/master/reference/commands_vim.txt
131-

‎font_install.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# (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'm using Iosevka Term Nerd Font)
4+
echo "[*] Downloading patch font into ~/.local/share/fonts ..."
5+
curl -fLo ~/.fonts/Iosevka\ Term\ Nerd\ Font\ Complete.ttf --create-dirs https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Iosevka/Regular/complete/Iosevka%20Term%20Nerd%20Font%20Complete.ttf
6+
echo "[+] Downloaded. Select Iosevka Term Regular as your terminal's custom font."

‎init.vim

+170-43
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
call plug#begin()
55

66
" Aesthetics - Main
7-
Plug 'dracula/vim', { 'commit': '147f389f4275cec4ef43ebc25e2011c57b45cc00' }
7+
Plug 'dracula/vim', { 'as': 'dracula' }
88
Plug 'vim-airline/vim-airline'
99
Plug 'vim-airline/vim-airline-themes'
10-
Plug 'ryanoasis/vim-devicons'
10+
Plug 'bryanmylee/vim-colorscheme-icons'
11+
Plug 'mhinz/vim-startify'
1112
Plug 'junegunn/goyo.vim'
1213
Plug 'junegunn/limelight.vim'
1314
Plug 'junegunn/seoul256.vim'
@@ -27,11 +28,12 @@ Plug 'tpope/vim-fugitive'
2728
Plug 'tpope/vim-sensible'
2829
Plug 'tpope/vim-surround'
2930
Plug 'majutsushi/tagbar'
30-
Plug 'scrooloose/nerdtree'
31+
Plug 'preservim/nerdtree'
32+
Plug 'Xuyuanp/nerdtree-git-plugin'
33+
Plug 'ryanoasis/vim-devicons'
3134
Plug 'scrooloose/nerdcommenter'
32-
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
33-
Plug 'deoplete-plugins/deoplete-jedi'
34-
Plug 'ervandew/supertab'
35+
Plug 'neoclide/coc.nvim', {'branch': 'release'}
36+
Plug 'mhinz/vim-signify'
3537
Plug 'jiangmiao/auto-pairs'
3638
Plug 'junegunn/vim-easy-align'
3739
Plug 'alvan/vim-closetag'
@@ -48,54 +50,62 @@ Plug 'SirVer/ultisnips'
4850
Plug 'honza/vim-snippets'
4951
Plug 'metakirby5/codi.vim'
5052
Plug 'dkarter/bullets.vim'
53+
Plug 'psliwka/vim-smoothie'
54+
Plug 'antoinemadec/FixCursorHold.nvim'
5155

5256
" Entertainment
53-
"Plug 'ryanss/vim-hackernews'
57+
Plug 'dansomething/vim-hackernews'
5458

5559
call plug#end()
5660

57-
""" Python3 VirtualEnv
58-
let g:python3_host_prog = expand('~/.config/nvim/env/bin/python')
59-
6061
""" Coloring
6162
syntax on
6263
color dracula
63-
highlight Pmenu guibg=white guifg=black gui=bold
64-
highlight Comment gui=bold
65-
highlight Normal gui=none
66-
highlight NonText guibg=none
64+
highlight Pmenu guibg=#363948
65+
highlight PmenuSbar guibg=#363948
66+
"highlight Comment gui=bold " Uncomment if you want comments to be in bold
6767

68-
" Opaque Background (Comment out to use terminal's profile)
68+
" Enable True Color Support (ensure you're using a 256-color enabled $TERM, e.g. xterm-256color)
6969
set termguicolors
7070

71-
" Transparent Background (For i3 and compton)
72-
highlight Normal guibg=NONE ctermbg=NONE
73-
highlight LineNr guibg=NONE ctermbg=NONE
71+
" Transparent Background
72+
function! TransparentBackground()
73+
" Uncomment if you are using a translucent terminal and you want nvim to use that.
74+
" Note: only uncomment the 4 lines below, and not the entire function, as it is being used throughout this config
75+
"highlight Normal guibg=NONE ctermbg=NONE
76+
"highlight LineNr guibg=NONE ctermbg=NONE
77+
"set fillchars+=vert:\│
78+
"highlight VertSplit gui=NONE guibg=NONE guifg=#444444 cterm=NONE ctermbg=NONE ctermfg=gray
79+
endfunction
7480

7581
""" Other Configurations
7682
filetype plugin indent on
7783
set tabstop=4 softtabstop=4 shiftwidth=4 expandtab smarttab autoindent
7884
set incsearch ignorecase smartcase hlsearch
85+
set wildmode=longest,list,full wildmenu
7986
set ruler laststatus=2 showcmd showmode
8087
set list listchars=trail:»,tab-
8188
set fillchars+=vert:\
8289
set wrap breakindent
8390
set encoding=utf-8
91+
set textwidth=0
92+
set hidden
8493
set number
8594
set title
95+
call TransparentBackground()
8696

8797
""" Plugin Configurations
8898

8999
" NERDTree
90100
let NERDTreeShowHidden=1
91-
let g:NERDTreeDirArrowExpandable = ''
92-
let g:NERDTreeDirArrowCollapsible = ''
101+
" Exit Vim if NERDTree is the only window left.
102+
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
93103

94104
" Airline
95105
let g:airline_powerline_fonts = 1
96106
let g:airline_section_z = ' %{strftime("%-I:%M %p")}'
97107
let g:airline_section_warning = ''
98-
"let g:airline#extensions#tabline#enabled = 1
108+
"let g:airline#extensions#tabline#enabled = 1 " Uncomment to display buffer tabline above
99109

100110
" Neovim :Terminal
101111
tmap <Esc> <C-\><C-n>
@@ -104,11 +114,6 @@ tmap <C-w> <Esc><C-w>
104114
autocmd BufWinEnter,WinEnter term://* startinsert
105115
autocmd BufLeave term://* stopinsert
106116

107-
" Deoplete
108-
let g:deoplete#enable_at_startup = 1
109-
" Disable documentation window
110-
set completeopt-=preview
111-
112117
" vim-pydocstring
113118
let g:pydocstring_doq_path = '~/.config/nvim/env/bin/doq'
114119

@@ -126,11 +131,14 @@ nmap ga <Plug>(EasyAlign)
126131
127132
" indentLine
128133
let g:indentLine_char = ''
129-
let g:indentLine_color_gui = '#363949'
134+
let g:indentLine_defaultGroup = 'NonText'
135+
" Disable indentLine from concealing json and markdown syntax (e.g. ```)
136+
let g:vim_json_syntax_conceal = 0
137+
let g:vim_markdown_conceal = 0
138+
let g:vim_markdown_conceal_code_blocks = 0
130139

131140
" TagBar
132141
let g:tagbar_width = 30
133-
let g:tagbar_iconchars = ['', '']
134142

135143
" fzf-vim
136144
let g:fzf_action = {
@@ -145,13 +153,128 @@ let g:fzf_colors =
145153
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
146154
\ 'hl+': ['fg', 'Statement'],
147155
\ 'info': ['fg', 'Type'],
148-
\ 'border': ['fg', 'Ignore'],
156+
\ 'border': ['fg', 'Constant'],
149157
\ 'prompt': ['fg', 'Character'],
150158
\ 'pointer': ['fg', 'Exception'],
151159
\ 'marker': ['fg', 'Keyword'],
152160
\ 'spinner': ['fg', 'Label'],
153161
\ 'header': ['fg', 'Comment'] }
154162

163+
" Bat theme for syntax coloring when viewing files in fzf
164+
let $BAT_THEME='base16'
165+
166+
" Limelight
167+
let g:limelight_conceal_ctermfg = 'gray'
168+
let g:limelight_conceal_guifg = 'gray'
169+
170+
" Startify
171+
let g:startify_fortune_use_unicode = 1
172+
173+
" Startify + NERDTree on start when no file is specified
174+
autocmd VimEnter *
175+
\ if !argc()
176+
\ | Startify
177+
\ | NERDTree
178+
\ | wincmd w
179+
\ | endif
180+
181+
" coc.vim START
182+
183+
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
184+
" delays and poor user experience.
185+
set updatetime=300
186+
187+
" Don't pass messages to |ins-completion-menu|.
188+
set shortmess+=c
189+
190+
" Always show the signcolumn, otherwise it would shift the text each time
191+
" diagnostics appear/become resolved.
192+
if has("nvim-0.5.0") || has("patch-8.1.1564")
193+
" Recently vim can merge signcolumn and number column into one
194+
set signcolumn=number
195+
else
196+
set signcolumn=yes
197+
endif
198+
199+
" Use tab for trigger completion with characters ahead and navigate.
200+
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
201+
" other plugin before putting this into your config.
202+
inoremap <silent><expr> <TAB>
203+
\ pumvisible() ? "\<C-n>" :
204+
\ <SID>check_back_space() ? "\<TAB>" :
205+
\ coc#refresh()
206+
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
207+
208+
function! s:check_back_space() abort
209+
let col = col('.') - 1
210+
return !col || getline('.')[col - 1] =~# '\s'
211+
endfunction
212+
213+
" Use <c-space> to trigger completion.
214+
if has('nvim')
215+
inoremap <silent><expr> <c-space> coc#refresh()
216+
else
217+
inoremap <silent><expr> <c-@> coc#refresh()
218+
endif
219+
220+
" Make <CR> auto-select the first completion item and notify coc.nvim to
221+
" format on enter, <cr> could be remapped by other vim plugin
222+
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
223+
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
224+
225+
" Use `[g` and `]g` to navigate diagnostics
226+
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
227+
nmap <silent> [g <Plug>(coc-diagnostic-prev)
228+
nmap <silent> ]g <Plug>(coc-diagnostic-next)
229+
230+
" GoTo code navigation.
231+
nmap <silent> gd <Plug>(coc-definition)
232+
nmap <silent> gy <Plug>(coc-type-definition)
233+
nmap <silent> gi <Plug>(coc-implementation)
234+
nmap <silent> gr <Plug>(coc-references)
235+
236+
" Use K to show documentation in preview window.
237+
nnoremap <silent> K :call <SID>show_documentation()<CR>
238+
239+
function! s:show_documentation()
240+
if (index(['vim','help'], &filetype) >= 0)
241+
execute 'h '.expand('<cword>')
242+
elseif (coc#rpc#ready())
243+
call CocActionAsync('doHover')
244+
else
245+
execute '!' . &keywordprg . " " . expand('<cword>')
246+
endif
247+
endfunction
248+
249+
" Highlight the symbol and its references when holding the cursor.
250+
autocmd CursorHold * silent call CocActionAsync('highlight')
251+
252+
" Symbol renaming.
253+
nmap <leader>rn <Plug>(coc-rename)
254+
255+
" Formatting selected code.
256+
xmap <leader>f <Plug>(coc-format-selected)
257+
nmap <leader>f <Plug>(coc-format-selected)
258+
259+
augroup mygroup
260+
autocmd!
261+
" Setup formatexpr specified filetype(s).
262+
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
263+
" Update signature help on jump placeholder.
264+
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
265+
augroup end
266+
267+
" coc.vim END
268+
269+
" signify
270+
let g:signify_sign_add = ''
271+
let g:signify_sign_delete = ''
272+
let g:signify_sign_change = ''
273+
hi DiffDelete guifg=red guibg=none
274+
275+
" FixCursorHold for better performance
276+
let g:cursorhold_updatetime = 100
277+
155278
""" Filetype-Specific Configurations
156279

157280
" HTML, XML, Jinja
@@ -178,40 +301,45 @@ endfunction
178301

179302
" Dracula Mode (Dark)
180303
function! ColorDracula()
181-
let g:airline_theme=''
304+
let g:airline_theme='dracula'
182305
color dracula
183-
IndentLinesEnable
306+
highlight Pmenu guibg=#363948
307+
highlight PmenuSbar guibg=#363948
308+
call TransparentBackground()
184309
endfunction
185310

186311
" Seoul256 Mode (Dark & Light)
187312
function! ColorSeoul256()
188313
let g:airline_theme='silver'
189314
color seoul256
190-
IndentLinesDisable
315+
call TransparentBackground()
191316
endfunction
192317

193318
" Forgotten Mode (Light)
194319
function! ColorForgotten()
195-
" Light airline themes: tomorrow, silver, alduin
196-
" Light colors: forgotten-light, nemo-light
320+
" Other light airline themes: tomorrow, silver, alduin
197321
let g:airline_theme='tomorrow'
322+
" Other light colors: forgotten-light, nemo-light
198323
color forgotten-light
199-
IndentLinesDisable
324+
call TransparentBackground()
200325
endfunction
201326

202327
" Zazen Mode (Black & White)
203328
function! ColorZazen()
204-
let g:airline_theme='badcat'
329+
let g:airline_theme='minimalist'
205330
color zazen
206-
IndentLinesEnable
331+
call TransparentBackground()
207332
endfunction
208333

209334
""" Custom Mappings
210335

211336
let mapleader=","
337+
nmap <leader>$s <C-w>s<C-w>j:terminal<CR>:set nonumber<CR><S-a>
338+
nmap <leader>$v <C-w>v<C-w>l:terminal<CR>:set nonumber<CR><S-a>
212339
nmap <leader>q :NERDTreeToggle<CR>
213340
nmap \ <leader>q
214341
nmap <leader>w :TagbarToggle<CR>
342+
nmap \| <leader>w
215343
nmap <leader>ee :Colors<CR>
216344
nmap <leader>ea :AirlineTheme
217345
nmap <leader>e1 :call ColorDracula()<CR>
@@ -220,21 +348,20 @@ nmap <leader>e3 :call ColorForgotten()<CR>
220348
nmap <leader>e4 :call ColorZazen()<CR>
221349
nmap <leader>r :so ~/.config/nvim/init.vim<CR>
222350
nmap <leader>t :call TrimWhitespace()<CR>
351+
nmap <leader>y <C-w>v<C-w>l:HackerNews best<CR>J
352+
nmap <leader>p <Plug>(pydocstring)
223353
xmap <leader>a gaip*
224354
nmap <leader>a gaip*
225-
nmap <leader>s <C-w>s<C-w>j:terminal<CR>
226-
nmap <leader>vs <C-w>v<C-w>l:terminal<CR>
227-
nmap <leader>d <Plug>(pydocstring)
228-
nmap <leader>f :Files<CR>
355+
nmap <leader>s :Rg<CR>
356+
nmap <leader>d :Files<CR>
357+
nmap <leader>f :BLines<CR>
229358
nmap <leader>g :Goyo<CR>
230359
nmap <leader>h :RainbowParentheses!!<CR>
231360
nmap <leader>j :set filetype=journal<CR>
232361
nmap <leader>k :ColorToggle<CR>
233362
nmap <leader>l :Limelight!!<CR>
234363
xmap <leader>l :Limelight!!<CR>
235364
autocmd FileType python nmap <leader>x :0,$!~/.config/nvim/env/bin/python -m yapf<CR>
236-
"nmap <leader>n :HackerNews best<CR>J
237365
nmap <silent> <leader><leader> :noh<CR>
238366
nmap <Tab> :bnext<CR>
239367
nmap <S-Tab> :bprevious<CR>
240-

‎install.sh

+13-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash -e
22

3+
# Installs Optixal's neovim-init.vim into ~/.config/nvim/init.vim. Intended for Ubuntu/Debian. I highly recommend running the following commands manually, especially if you are running macOS or other Linux distros. For macOS, use homebrew instead of apt.
4+
35
# Make config directory for Neovim's init.vim
46
echo '[*] Preparing Neovim config directory ...'
57
mkdir -p ~/.config/nvim
@@ -9,37 +11,29 @@ echo '[*] App installing Neovim and its dependencies (Python 3 and git), and dep
911
sudo apt update
1012
sudo apt install neovim python3 python3-pip python3-venv git curl exuberant-ctags -y
1113

12-
# Install virtualenv to containerize dependencies
13-
echo '[*] Pip installing venv to containerize Neovim dependencies (instead of installing them onto your system) ...'
14-
python3 -m venv ~/.config/nvim/env
14+
# Install Node.js v16.x (for Ubuntu) for coc.vim
15+
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
16+
sudo apt install -y nodejs
1517

16-
# Install pip modules for Neovim within the virtual environment created
17-
echo '[*] Activating virtualenv and pip installing Neovim (for Python plugin support), libraries for async autocompletion support (jedi, psutil, setproctitle), and library for pep8-style formatting (yapf) ...'
18-
source ~/.config/nvim/env/bin/activate
19-
pip install pynvim jedi psutil setproctitle yapf doq # run `pip uninstall neovim pynvim` if still using old neovim module
20-
deactivate
18+
# Install The Silver Searcher (ag), ripgrep (rg) and bat for fzf.vim
19+
sudo apt install -y silversearcher-ag
20+
sudo apt install -y -o Dpkg::Options::="--force-overwrite" bat ripgrep # https://github.com/sharkdp/bat/issues/938
2121

2222
# Install vim-plug plugin manager
2323
echo '[*] Downloading vim-plug, the best minimalistic vim plugin manager ...'
2424
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
2525

26-
# (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 Iosevka for Powerline)
27-
echo "[*] Downloading patch font into ~/.local/share/fonts ..."
28-
curl -fLo ~/.fonts/Iosevka\ Term\ Nerd\ Font\ Complete.ttf --create-dirs https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Iosevka/Regular/complete/Iosevka%20Term%20Nerd%20Font%20Complete.ttf
29-
30-
# (Optional) Alias vim -> nvim
31-
echo '[*] Aliasing vim -> nvim, remember to source ~/.bashrc ...'
32-
echo "alias vim='nvim'" >> ~/.bashrc
26+
# Create a backup of your current init.vim if you have one
27+
cp ~/.config/nvim/init.vim ~/.config/nvim/init.vim.backup 2> /dev/null
3328

34-
# Enter Neovim and install plugins using a temporary init.vim, which avoids warnings about missing colorschemes, functions, etc
29+
# Enter Neovim and install plugins with vim-plug's :PlugInstall and coc extensions with CoC's :CocInstall using a temporary init.vim, which avoids warnings about missing colorschemes, functions, etc
3530
echo -e '[*] Running :PlugInstall within nvim ...'
3631
sed '/call plug#end/q' init.vim > ~/.config/nvim/init.vim
37-
nvim -c ':PlugInstall' -c ':UpdateRemotePlugins' -c ':qall'
32+
nvim -c 'PlugInstall' -c 'CocInstall -sync coc-tsserver coc-json coc-html coc-css coc-pyright' -c 'qa'
3833
rm ~/.config/nvim/init.vim
3934

4035
# Copy init.vim in current working directory to nvim's config location ...
4136
echo '[*] Copying init.vim -> ~/.config/nvim/init.vim'
4237
cp init.vim ~/.config/nvim/
4338

44-
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"
45-
39+
echo -e "[+] Done, welcome to your new \033[1m\033[92mNeovim\033[0m experience! Try it by running: nvim/vim. Want to customize it? Modify ~/.config/nvim/init.vim! Remember to change your terminal font to Iosevka Term Regular, or any other preferred nerd font :)"

0 commit comments

Comments
 (0)
Please sign in to comment.