1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

chore: remove short url and replace with true url

This commit is contained in:
jdhao 2020-03-30 23:32:11 +08:00
parent 823e09f5b6
commit 1b97735bf2
8 changed files with 62 additions and 54 deletions

View File

@ -4,14 +4,15 @@ set formatoptions-=o
" Disable inserting comment leader after hitting <Enter> in insert mode
set formatoptions-=r
" Set the folding related options for vim script. Setting folding option
" in modeline is annoying in that the modeline get executed each time the
" window focus is lost (see http://tinyurl.com/yyqyyhnc)
" Set the folding related options for vim script. Setting folding option in
" modeline is annoying in that the modeline get executed each time the window
" focus is lost (see
" https://github.com/tmux-plugins/vim-tmux-focus-events/issues/14)
set foldmethod=expr foldlevel=0 foldlevelstart=-1
\ foldexpr=utils#VimFolds(v:lnum) foldtext=utils#MyFoldText()
" Use :help command for keyword when pressing `K` in vim file,
" see `:h K` and https://bre.is/wC3Ih-26u
" see `:h K` and https://stackoverflow.com/q/15867323/6064933
set keywordprg=:help
" Only define following variable if Auto-pairs plugin is used

View File

@ -1,5 +1,5 @@
"{ Auto commands
" Do not use smart case in command line mode, extracted from https://goo.gl/vCTYdK.
" Do not use smart case in command line mode, extracted from https://vi.stackexchange.com/a/16511/15292.
augroup dynamic_smartcase
autocmd!
autocmd CmdLineEnter : set nosmartcase
@ -41,7 +41,8 @@ augroup END
" Automatically reload the file if it is changed outside of Nvim, see
" https://unix.stackexchange.com/a/383044/221410. It seems that `checktime`
" command does not work in command line. We need to check if we are in command
" line before executing this command. See also http://tinyurl.com/y6av4sy9.
" line before executing this command. See also
" https://vi.stackexchange.com/a/20397/15292.
augroup auto_read
autocmd!
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI *

View File

@ -6,7 +6,7 @@ function utils#StripTrailingWhitespaces() abort
call winrestview(l:save)
endfunction
" Create command alias safely, see https://bit.ly/2ImFOpL.
" Create command alias safely, see https://stackoverflow.com/q/3878692/6064933
" The following two functions are taken from answer below on SO:
" https://stackoverflow.com/a/10708687/6064933
function! utils#Cabbrev(key, value) abort
@ -18,8 +18,9 @@ function! s:Single_quote(str) abort
return "'" . substitute(copy(a:str), "'", "''", 'g') . "'"
endfunction
" Check the syntax group in the current cursor position,
" see http://tinyurl.com/yyzgswxz and http://tinyurl.com/y3lxozey
" Check the syntax group in the current cursor position, see
" https://stackoverflow.com/q/9464844/6064933 and
" https://jordanelver.co.uk/blog/2015/05/27/working-with-vim-colorschemes/
function! utils#SynGroup() abort
if !exists('*synstack')
return

View File

@ -10,7 +10,7 @@
" "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" The above ASCII art is generated using service provided in this webpage:
" http://tinyurl.com/y6szckgd.
" https://www.kammerl.de/ascii/AsciiSignature.php.
"{ Header and Licence
"{{ header info

View File

@ -40,17 +40,17 @@ nnoremap [Q :cfirst<CR>zv
nnoremap ]Q :clast<CR>zv
" Close location list or quickfix list if they are present,
" see https://goo.gl/uXncnS
" see https://superuser.com/q/355325/736190
nnoremap<silent> \x :windo lclose <bar> cclose<CR>
" Close a buffer and switching to another buffer, do not close the
" window, see https://goo.gl/Wd8yZJ
" window, see https://stackoverflow.com/q/4465095/6064933
nnoremap <silent> \d :bprevious <bar> bdelete #<CR>
" Toggle search highlight, see https://goo.gl/3H85hh
" Toggle search highlight, see https://stackoverflow.com/a/26504944/6064933
nnoremap <silent><expr> <Leader>hl (&hls && v:hlsearch ? ':nohls' : ':set hls')."\n"
" Disable arrow key in vim, see https://goo.gl/s1yfh4.
" Disable arrow key in vim, see https://superuser.com/q/599150/736190
nnoremap <Up> <nop>
nnoremap <Down> <nop>
nnoremap <Left> <nop>
@ -87,7 +87,7 @@ nnoremap <silent> ^ g^
nnoremap <silent> 0 g0
" Do not include white space characters when using $ in visual mode,
" see https://goo.gl/PkuZox
" see https://vi.stackexchange.com/q/12607/15292
xnoremap $ g_
" Jump to matching pairs easily in normal mode
@ -100,8 +100,9 @@ nnoremap L g_
xnoremap L g_
" Resize windows using <Alt> and h,j,k,l, inspiration from
" https://goo.gl/vVQebo (bottom page).
" If you enable mouse support, shorcuts below may not be necessary.
" https://vim.fandom.com/wiki/Fast_window_resizing_with_plus/minus_keys
" (bottom page). If you enable mouse support, shorcuts below may not be
" necessary.
nnoremap <silent> <M-h> <C-w><
nnoremap <silent> <M-l> <C-w>>
nnoremap <silent> <M-j> <C-W>-
@ -115,13 +116,14 @@ nnoremap <silent> <M-down> <C-w>j
nnoremap <silent> <M-up> <C-w>k
" Continuous visual shifting (does not exit Visual mode), `gv` means
" to reselect previous visual area, see https://goo.gl/m1UeiT
" to reselect previous visual area, see https://superuser.com/q/310417/736190
xnoremap < <gv
xnoremap > >gv
" When completion menu is shown, use <cr> to select an item
" and do not add an annoying newline. Otherwise, <enter> is what it is.
" For more info , see https://goo.gl/KTHtrr and https://goo.gl/MH7w3b
" When completion menu is shown, use <cr> to select an item and do not add an
" annoying newline. Otherwise, <enter> is what it is. For more info , see
" https://superuser.com/a/941082/736190 and
" https://unix.stackexchange.com/q/162528/221410
inoremap <expr> <cr> ((pumvisible())?("\<C-Y>"):("\<cr>"))
" Use <esc> to close auto-completion menu
inoremap <expr> <esc> ((pumvisible())?("\<C-e>"):("\<esc>"))
@ -156,8 +158,8 @@ inoremap <silent> <F11> <C-O>:set spell! <bar> :AutoSaveToggle<cr>
" Decrease indent level in insert mode with shift+tab
inoremap <S-Tab> <ESC><<i
" Change text without putting the text into register,
" see http://tinyurl.com/y2ap4h69
" Change text without putting it into the vim register,
" see https://stackoverflow.com/q/54255/6064933
nnoremap c "_c
nnoremap C "_C
nnoremap cc "_cc

View File

@ -10,17 +10,17 @@ set pastetoggle=<F12>
set splitbelow splitright
" Time in milliseconds to wait for a mapped sequence to complete,
" see https://goo.gl/vHvyu8 for more info
" see https://unix.stackexchange.com/q/36882/221410 for more info
set timeoutlen=1000
" For CursorHold events
set updatetime=2000
" Clipboard settings, always use clipboard for all delete, yank, change, put
" operation, see https://goo.gl/YAHBbJ
" operation, see https://stackoverflow.com/q/30691466/6064933
set clipboard+=unnamedplus
" Disable creating swapfiles, see https://goo.gl/FA6m6h
" Disable creating swapfiles, see https://stackoverflow.com/q/821902/6064933
set noswapfile
" Set up backup directory
@ -62,7 +62,7 @@ set wildmode=list:full
" Show current line where the cursor is
set cursorline
" Set a ruler at column 80, see https://goo.gl/vEkF5i
" Set a ruler at column 80, see https://stackoverflow.com/q/2447109/6064933
set colorcolumn=80
" Minimum lines to keep above and below cursor when scrolling
@ -106,10 +106,10 @@ set list listchars=tab:▸\ ,extends:,precedes:,nbsp:+
" Auto-write the file based on some condition
set autowrite
" Show hostname, full path of file and last-mod time on the window title.
" The meaning of the format str for strftime can be found in
" http://tinyurl.com/l9nuj4a. The function to get lastmod time is drawn from
" http://tinyurl.com/yxd23vo8
" Show hostname, full path of file and last-mod time on the window title. The
" meaning of the format str for strftime can be found in
" http://man7.org/linux/man-pages/man3/strftime.3.html. The function to get
" lastmod time is drawn from https://stackoverflow.com/q/8426736/6064933
set title
set titlestring=
set titlestring+=%(%{hostname()}\ \ %)
@ -141,21 +141,21 @@ set spelllang=en,cjk " Spell languages
set spellsuggest+=10 " The number of suggestions shown in the screen for z=
" Align indent to next multiple value of shiftwidth. For its meaning,
" see http://tinyurl.com/y5n87a6m
" see http://vim.1045645.n5.nabble.com/shiftround-option-td5712100.html
set shiftround
" Virtual edit is useful for visual block edit
set virtualedit=block
" Correctly break multi-byte characters such as CJK,
" see http://tinyurl.com/y4sq6vf3
" see https://stackoverflow.com/q/32669814/6064933
set formatoptions+=mM
" Tilde (~) is an operator, thus must be followed by motions like `e` or `w`.
set tildeop
" Do not add two space after a period when joining lines or formatting texts,
" see https://tinyurl.com/y3yy9kov
" Do not add two spaces after a period when joining lines or formatting texts,
" see https://stackoverflow.com/q/4760428/6064933
set nojoinspaces
" Text after this column number is not highlighted

View File

@ -1,9 +1,10 @@
"{ Plugin installation
"{{ Vim-plug Install and related settings
" Auto-install vim-plug on different systems if it does not exist.
" For Windows, only Windows 10 with curl installed are supported (after
" Windows 10 build 17063, source: http://tinyurl.com/y23972tt).
" Auto-install vim-plug on different systems if it does not exist. For
" Windows, only Windows 10 with curl installed are supported (after Windows 10
" build 17063, source:
" https://devblogs.microsoft.com/commandline/tar-and-curl-come-to-windows/).
" The following script to install vim-plug is adapted from vim-plug
" wiki: https://github.com/junegunn/vim-plug/wiki/tips#tips
let g:VIM_PLUG_PATH = expand(g:nvim_config_root . '/autoload/plug.vim')
@ -160,7 +161,7 @@ Plug '907th/vim-auto-save'
" graphcial undo history, see https://github.com/mbbill/undotree
Plug 'mbbill/undotree'
" another plugin to show undo history is: http://tinyurl.com/jlsgjy5
" another plugin to show undo history
" Plug 'simnalamburt/vim-mundo'
" Manage your yank history
@ -263,7 +264,7 @@ Plug 'michaeljsmith/vim-indent-object'
if ( g:is_win || g:is_mac ) && executable('latex')
" vimtex use autoload feature of Vim, so it is not necessary to use `for`
" keyword of vim-plug to try to lazy-load it,
" see http://tinyurl.com/y3ymc4qd
" see https://github.com/junegunn/vim-plug/issues/785
Plug 'lervag/vimtex'
" Plug 'matze/vim-tex-fold', {'for': 'tex'}
@ -276,7 +277,8 @@ endif
" for Linux and Mac
if (g:is_linux || g:is_mac) && executable('tmux')
" Let vim detect tmux focus event correctly, see
" http://tinyurl.com/y4xd2w3r and http://tinyurl.com/y4878wwm
" https://github.com/neovim/neovim/issues/9486 and
" https://vi.stackexchange.com/q/18515/15292
Plug 'tmux-plugins/vim-tmux-focus-events'
" .tmux.conf syntax highlighting and setting check
@ -343,8 +345,7 @@ let g:deoplete#enable_at_startup = 1
" Maximum candidate window width
call deoplete#custom#source('_', 'max_menu_width', 80)
" Minimum character length needed to activate auto-completion,
" see https://goo.gl/QP9am2
" Minimum character length needed to activate auto-completion.
call deoplete#custom#source('_', 'min_pattern_length', 1)
" Whether to disable completion for certain syntax
@ -375,10 +376,10 @@ call deoplete#custom#option('auto_complete_delay', 100)
call deoplete#custom#option('auto_complete', v:true)
" Automatically close function preview windows after completion
" see https://goo.gl/Bn5n39
" see https://github.com/Shougo/deoplete.nvim/issues/115.
" autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
" Tab-complete, see https://goo.gl/LvwZZY
" Tab-complete, see https://vi.stackexchange.com/q/19675/15292.
" inoremap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
"""""""""""""""""""""""""UltiSnips settings"""""""""""""""""""
@ -397,11 +398,12 @@ let g:UltiSnipsSnippetDirectories=['UltiSnips', 'my_snippets']
" Auto-close method preview window
let g:SuperTabClosePreviewOnPopupClose = 1
" Use the default top to bottom way for scroll, see https://goo.gl/APdo9V
" Use the default top to bottom way for scroll, see
" https://github.com/ervandew/supertab#frequently-asked-questions
let g:SuperTabDefaultCompletionType = '<c-n>'
" Shortcut to navigate forward and backward in completion menu,
" see https://is.gd/AoSv4m
" see https://github.com/ervandew/supertab/blob/master/doc/supertab.txt#L280
let g:SuperTabMappingForward = '<tab>'
let g:SuperTabMappingBackward = '<s-tab>'
"}}
@ -501,11 +503,11 @@ endif
"{{ Navigation and tags
""""""""""""""""""""""" nerdtree settings """"""""""""""""""""""""""
" Toggle nerdtree window and keep cursor in file window,
" adapted from http://tinyurl.com/y2kt8cy9
" adapted from https://stackoverflow.com/q/24808932/6064933
nnoremap <silent> <Space>s :NERDTreeToggle<CR>:wincmd p<CR>
" Reveal currently editted file in nerdtree widnow,
" see https://goo.gl/kbxDVK
" see https://stackoverflow.com/q/7692233/6064933
nnoremap <silent> <Space>f :NERDTreeFind<CR>
" Ignore certain files and folders
@ -514,7 +516,7 @@ let NERDTreeIgnore = ['\.pyc$', '^__pycache__$']
" Automatically show nerdtree window on entering nvim,
" see https://github.com/scrooloose/nerdtree. But now the cursor
" is in nerdtree window, so we need to change it to the file window,
" extracted from https://goo.gl/vumpvo
" extracted from https://stackoverflow.com/q/24808932/6064933
" autocmd VimEnter * NERDTree | wincmd l
" Delete a file buffer when you have deleted it in nerdtree
@ -795,7 +797,7 @@ let g:airline#extensions#tagbar#enabled = 1
" extracted from https://vi.stackexchange.com/a/9637/15292
let g:airline_skip_empty_sections = 1
" Whether to use powerline symbols, see https://goo.gl/XLY19H.
" Whether to use powerline symbols, see https://vi.stackexchange.com/q/3359/15292
let g:airline_powerline_fonts = 0
if !exists('g:airline_symbols')

7
ui.vim
View File

@ -1,8 +1,9 @@
"{ UI-related settings
"{{ General settings about colors
" Enable true colors support. Do not use this option if your terminal does not
" Enable true colors support. Do not set this option if your terminal does not
" support true colors! For a comprehensive list of terminals supporting true
" colors, see https://github.com/termstandard/colors and https://bit.ly/2InF97t.
" colors, see https://github.com/termstandard/colors and
" https://gist.github.com/XVilka/8346728.
if $TERM == "xterm-256color" || exists('g:started_by_firenvim')
set termguicolors
endif
@ -16,7 +17,7 @@ set background=dark
" error message when starting Nvim
if utils#HasColorscheme('gruvbox8')
" Italic options should be put before colorscheme setting,
" see https://goo.gl/8nXhcp
" see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled
let g:gruvbox_italics=1
let g:gruvbox_italicize_strings=1
let g:gruvbox_filetype_hi_groups = 0