-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathplugins.vim
173 lines (122 loc) Β· 4.19 KB
/
plugins.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
" <<<< using vim plug >>>>
" ref - https://github.com/junegunn/vim-plug
" <<<< installation >>>>
" https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" <<<<<<<< plugins >>>>>>>>
call plug#begin()
" << languages >>
" typescript/javascript
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
" powershell
Plug 'PProvost/vim-ps1'
" code blocks in markdown files
Plug 'tpope/vim-markdown'
" << formatting/linting >>
" post install load plugin only for editing supported files
" ref - https://github.com/prettier/vim-prettier
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install',
\ 'for': [
\ 'javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql',
\ 'markdown', 'vue', 'yaml', 'html'
\]
\}
" black code formatting (python)
Plug 'ambv/black'
" << motions/operators >>
" edit surrounding characters
Plug 'tpope/vim-surround'
" repeat plugin actions
Plug 'tpope/vim-repeat'
" comment code
Plug 'tpope/vim-commentary'
" << utilities >>
" Neovim markdown previewer (opens preview in browser)
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' }
" git information (blame, diff) in Vim
Plug 'iamcco/sran.nvim', { 'do': { -> sran#util#install() } }
Plug 'iamcco/git-p.nvim'
" highlight whitespace
Plug 'ntpeters/vim-better-whitespace'
" distraction free writing
Plug 'junegunn/goyo.vim'
" highlight currently editing text
Plug 'junegunn/limelight.vim'
" open current line in github
" note: opens most recent blob so only works if you are downstream of remote
Plug 'ruanyl/vim-gh-line'
call plug#end()
" <<<<<<<< config >>>>>>>>
" <<<<<< formatting/linting >>>>>>
" <<<< vim-prettier >>>>
" ref - https://github.com/prettier/vim-prettier#configuration
" force async
let g:prettier#exec_cmd_async = 1
" run pre save
let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
" <<<< black >>>>
" ref - https://github.com/ambv/black#vim
" << options >>
autocmd BufWritePre *.py execute ':Black'
" <<<<<< motions/operators >>>>>>
" <<<< vim-surround >>>>
" ref - https://github.com/tpope/vim-surround#surroundvim
" << keymap >>
" add keystrokes to surround with `<>`
let g:surround_{char2nr('s')} = "<\r>"
let g:surround_{char2nr('S')} = "< \r >"
" <<<<<< utilities >>>>>>
" <<<< vim-markdown >>>>
" ref - tpope/vim-markdown
" << options >>
let g:markdown_fenced_languages = [
\'javascript',
\'typescript',
\'python',
\'bash=sh',
\'sh'
\]
" <<<< git-p.nvim (git info) >>>>
" ref - https://github.com/iamcco/git-p.nvim#usage--config
" << options >>
let g:gitp_blame_format = ' %{account} ~ %{ago} β’ %{commit}'
" << keymap >>
" use <leader>d to display change
" TODO: figure out what's going wrong here, start by not shadowing shortcut
nmap <leader>d <Plug>(git-p-diff-preview)
" <<<< vim-better-whitespace >>>>
" ref - https://github.com/ntpeters/vim-better-whitespace#usage
" << options >>
let g:strip_whitespace_on_save=1
let g:strip_whitespace_confirm=0
let g:strip_whitelines_at_eof=1
" <<<< limelight.vim >>>>
" ref - https://github.com/junegunn/limelight.vim#options
" << options >>
" TODO: figure out why I can't pass an argument, what passing an argument should
" do, and how to background text fully dark
" https://github.com/junegunn/limelight.vim/issues/27
let g:limelight_conceal_ctermfg = 'Black'
" goyo integration
autocmd! User GoyoEnter Limelight
autocmd! User GoyoLeave Limelight!
" reset colors on exiting goyo (workaround)
" refs:
" - https://github.com/junegunn/goyo.vim/issues/160
" - https://github.com/junegunn/goyo.vim/pull/195
autocmd! User GoyoLeave source $HOME/.vimrc
" << keymap >>
nmap <leader>g :Goyo<CR>
nmap <leader>l :Limelight!!<CR>
" <<<< vim-gh-line >>>>
" ref - https://github.com/ruanyl/vim-gh-line#how-to-use
" << options >>
let g:gh_line_map = '<leader>mgl' " `mgl` for `misc git link`
let g:gh_line_blame_map = '<leader>mgb' " `mgb` for `misc git blame`