separate plugin from vimrc, rename vimrc
new nmap on `:tabe vimrc` relevant merge 2 augroups in vimrc remove popup from 'completeopt' which fails on other platform
This commit is contained in:
parent
41e8267aee
commit
9e8c6a35d7
3 changed files with 69 additions and 64 deletions
20
README.md
20
README.md
|
@ -5,27 +5,27 @@ and to record the evolutionary history of my vimrc.
|
||||||
Not suitable for others now, but I will try to improve it.
|
Not suitable for others now, but I will try to improve it.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
### Install [vim-plug](https://github.com/junegunn/vim-plug)
|
|
||||||
```sh
|
|
||||||
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
|
||||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
||||||
```
|
|
||||||
### Clone this repo
|
### Clone this repo
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/sup39/vimrc $HOME/.vim/sup39
|
git clone https://github.com/sup39/vimrc $HOME/.vim/sup39
|
||||||
```
|
```
|
||||||
### Import in your vimrc
|
### Import in your vimrc
|
||||||
You can simply use it.
|
In your vimrc:
|
||||||
```vim
|
```vim
|
||||||
" In your vimrc
|
" If you want to use vim-plug that I'm using:
|
||||||
|
" This script will install vim-plug automatically.
|
||||||
|
" Make sure to source plug.vim BEFORE vimrc
|
||||||
|
source $HOME/.vim/sup39/plug.vim
|
||||||
|
|
||||||
" set your `mapleader` and `maplocalleader` here if you want
|
" set your `mapleader` and `maplocalleader` here if you want
|
||||||
source $HOME/.vim/sup39/sup39.vimrc
|
source $HOME/.vim/sup39/vimrc
|
||||||
" you can override my settings here
|
" you can override my settings here
|
||||||
```
|
```
|
||||||
Or maybe make a Activate Command.
|
|
||||||
|
Alternatively, you can make a activate command to source it manually.
|
||||||
```vim
|
```vim
|
||||||
" In your vimrc
|
" In your vimrc
|
||||||
command Sup39Source source $HOME/.vim/sup39/sup39.vimrc
|
command Sup39Source source $HOME/.vim/sup39/vimrc
|
||||||
" anywhere when you want to activate it
|
" anywhere when you want to activate it
|
||||||
:Sup39Source
|
:Sup39Source
|
||||||
" You may need to :e to trigger the autocmd
|
" You may need to :e to trigger the autocmd
|
||||||
|
|
41
plug.vim
Normal file
41
plug.vim
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
if !filereadable($HOME.'/.vim/autoload/plug.vim')
|
||||||
|
echom 'Installing vim-plug...'
|
||||||
|
call system('curl -fLo $HOME/.vim/autoload/plug.vim --create-dirs '.
|
||||||
|
\'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim')
|
||||||
|
source $HOME/.vim/autoload/plug.vim
|
||||||
|
echom 'DONE! You may need to :PlugInstall to install listed plugins'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" plugin
|
||||||
|
call plug#begin('~/.vim/plugged')
|
||||||
|
" basic
|
||||||
|
Plug 'tpope/vim-sensible'
|
||||||
|
|
||||||
|
" markdown syntax
|
||||||
|
Plug 'plasticboy/vim-markdown'
|
||||||
|
let g:vim_markdown_new_list_item_indent = 0
|
||||||
|
let g:vim_markdown_math = 1
|
||||||
|
|
||||||
|
" markdown preview
|
||||||
|
Plug 'iamcco/markdown-preview.nvim', {'do': 'cd app & yarn install'}
|
||||||
|
let g:mkdp_auto_start = 0
|
||||||
|
let g:mkdp_auto_close = 0
|
||||||
|
let g:mkdp_preview_options = {
|
||||||
|
\ 'katex': {
|
||||||
|
\ 'macros': {
|
||||||
|
\ '\s': '\square',
|
||||||
|
\ },
|
||||||
|
\ },
|
||||||
|
\}
|
||||||
|
|
||||||
|
" ale
|
||||||
|
Plug 'dense-analysis/ale'
|
||||||
|
let g:ale_sign_error = '>>'
|
||||||
|
let g:ale_sign_warning = '--'
|
||||||
|
let g:ale_sign_column_always = 1
|
||||||
|
let g:ale_completion_enabled = 1
|
||||||
|
let g:ale_linters = {
|
||||||
|
\ 'cpp': ['gcc'],
|
||||||
|
\ 'swift': ['sourcekitlsp'],
|
||||||
|
\ }
|
||||||
|
call plug#end()
|
|
@ -1,11 +1,12 @@
|
||||||
" map-leader
|
" map-leader
|
||||||
if !exists('mapleader')
|
if !exists('mapleader')
|
||||||
let mapleader='q'
|
let mapleader='q'
|
||||||
nnoremap q <nop>
|
nnoremap <leader> <nop>
|
||||||
nnoremap Q q
|
nnoremap Q q
|
||||||
endif
|
endif
|
||||||
if !exists('maplocalleader')
|
if !exists('maplocalleader')
|
||||||
let maplocalleader='qw'
|
let maplocalleader='qw'
|
||||||
|
noremap <localleader> <nop>
|
||||||
endif
|
endif
|
||||||
inoremap jk <ESC>
|
inoremap jk <ESC>
|
||||||
" file
|
" file
|
||||||
|
@ -16,7 +17,9 @@ inoremap jk <ESC>
|
||||||
nnoremap <leader>C :w !pbcopy<CR><CR>
|
nnoremap <leader>C :w !pbcopy<CR><CR>
|
||||||
" tab edit
|
" tab edit
|
||||||
nnoremap <leader>e :tabe
|
nnoremap <leader>e :tabe
|
||||||
nnoremap <leader>v :tabe $HOME/.vim/sup39/sup39.vimrc<CR>
|
nnoremap <leader>vv :tabe $HOME/.vim/sup39/vimrc<CR>
|
||||||
|
nnoremap <leader>vp :tabe $HOME/.vim/sup39/plug.vim<CR>
|
||||||
|
nnoremap <leader>vd :tabe $HOME/.vim/sup39/
|
||||||
nnoremap <leader>V :tabe $MYVIMRC<CR>
|
nnoremap <leader>V :tabe $MYVIMRC<CR>
|
||||||
" search
|
" search
|
||||||
nnoremap / /\v
|
nnoremap / /\v
|
||||||
|
@ -41,7 +44,7 @@ nnoremap <leader>X :exe getline('.')<CR>
|
||||||
nnoremap <leader>H :echo synIDattr(synID(line("."),col("."),1),"name")<CR>
|
nnoremap <leader>H :echo synIDattr(synID(line("."),col("."),1),"name")<CR>
|
||||||
|
|
||||||
" filetype-dependent
|
" filetype-dependent
|
||||||
augroup sup39_map
|
augroup sup39_auto
|
||||||
autocmd!
|
autocmd!
|
||||||
" vim
|
" vim
|
||||||
" source
|
" source
|
||||||
|
@ -58,7 +61,17 @@ augroup sup39_map
|
||||||
autocmd Filetype c,cpp iabbrev <buffer> #i #include
|
autocmd Filetype c,cpp iabbrev <buffer> #i #include
|
||||||
" markdown
|
" markdown
|
||||||
" plugin
|
" plugin
|
||||||
nnoremap <localleader>p :MarkdownPreview<CR>
|
autocmd Filetype markdown nnoremap <localleader>p :MarkdownPreview<CR>
|
||||||
|
" COMMON
|
||||||
|
" disable auto comment prefix
|
||||||
|
autocmd Filetype * setlocal formatoptions-=ro
|
||||||
|
" keyword
|
||||||
|
autocmd Filetype javascript,typescript,vue setlocal iskeyword+=$
|
||||||
|
autocmd Filetype html,vue setlocal iskeyword+=-
|
||||||
|
" tab
|
||||||
|
autocmd FileType make,java,python setlocal noexpandtab
|
||||||
|
" syntax sync
|
||||||
|
autocmd FileType markdown,vue syntax sync fromstart
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" basic
|
" basic
|
||||||
|
@ -76,53 +89,4 @@ set autoindent smartindent
|
||||||
let g:vim_indent_cont = 0
|
let g:vim_indent_cont = 0
|
||||||
|
|
||||||
" completion
|
" completion
|
||||||
set completeopt=menu,menuone,popup,noselect,noinsert
|
set completeopt=menu,menuone,noselect,noinsert
|
||||||
|
|
||||||
|
|
||||||
" plugin
|
|
||||||
call plug#begin('~/.vim/plugged')
|
|
||||||
" basic
|
|
||||||
Plug 'tpope/vim-sensible'
|
|
||||||
|
|
||||||
" markdown syntax
|
|
||||||
Plug 'plasticboy/vim-markdown'
|
|
||||||
let g:vim_markdown_new_list_item_indent = 0
|
|
||||||
let g:vim_markdown_math = 1
|
|
||||||
|
|
||||||
" markdown preview
|
|
||||||
Plug 'iamcco/markdown-preview.nvim', {'do': 'cd app & yarn install'}
|
|
||||||
let g:mkdp_auto_start = 0
|
|
||||||
let g:mkdp_auto_close = 0
|
|
||||||
let g:mkdp_preview_options = {
|
|
||||||
\ 'katex': {
|
|
||||||
\ 'macros': {
|
|
||||||
\ '\s': '\square',
|
|
||||||
\ },
|
|
||||||
\ },
|
|
||||||
\}
|
|
||||||
|
|
||||||
" ale
|
|
||||||
Plug 'dense-analysis/ale'
|
|
||||||
let g:ale_sign_error = '>>'
|
|
||||||
let g:ale_sign_warning = '--'
|
|
||||||
let g:ale_sign_column_always = 1
|
|
||||||
let g:ale_completion_enabled = 1
|
|
||||||
let g:ale_linters = {
|
|
||||||
\ 'cpp': ['gcc'],
|
|
||||||
\ 'swift': ['sourcekitlsp'],
|
|
||||||
\ }
|
|
||||||
call plug#end()
|
|
||||||
|
|
||||||
" override
|
|
||||||
augroup sup39_override
|
|
||||||
autocmd!
|
|
||||||
" override plugin
|
|
||||||
autocmd Filetype * setlocal formatoptions-=ro
|
|
||||||
" keyword
|
|
||||||
autocmd Filetype javascript,typescript,vue setlocal iskeyword+=$
|
|
||||||
autocmd Filetype html,vue setlocal iskeyword+=-
|
|
||||||
" tab
|
|
||||||
autocmd FileType make,java,python setlocal noexpandtab
|
|
||||||
" syntax
|
|
||||||
autocmd FileType markdown,vue syntax sync fromstart
|
|
||||||
augroup END
|
|
Loading…
Reference in a new issue