Merge branch 'dev' of https://github.com/Donaldttt/dotfiles into dev
This commit is contained in:
@@ -4,3 +4,4 @@
|
|||||||
.vim/
|
.vim/
|
||||||
autoload/
|
autoload/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
tags
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
let g:vim_version = str2float(g:vim_version)
|
let g:vim_version = str2float(g:vim_version)
|
||||||
let g:dotfile_path = '~/.dotfiles/'
|
let g:dotfile_path = '~/.dotfiles/'
|
||||||
|
|
||||||
|
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
||||||
|
let &packpath=&runtimepath
|
||||||
|
|
||||||
" The default leader is '\', but many people prefer ',' as it's in a standard
|
" The default leader is '\', but many people prefer ',' as it's in a standard
|
||||||
let mapleader = ','
|
let mapleader = ','
|
||||||
let maplocalleader = '_'
|
let maplocalleader = '_'
|
||||||
@@ -35,7 +38,7 @@
|
|||||||
" Always switch to the current file directory
|
" Always switch to the current file directory
|
||||||
|
|
||||||
set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
|
set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
|
||||||
set viewoptions=folds,options,cursor,unix,slash " Better Unix / Windows compatibility
|
" set viewoptions=folds,options,cursor,unix,slash " Better Unix / Windows compatibility
|
||||||
set virtualedit=onemore " Allow for cursor beyond last character
|
set virtualedit=onemore " Allow for cursor beyond last character
|
||||||
set history=1000 " Store a ton of history (default is 20)
|
set history=1000 " Store a ton of history (default is 20)
|
||||||
set hidden " Allow buffer switching without saving
|
set hidden " Allow buffer switching without saving
|
||||||
@@ -165,20 +168,16 @@
|
|||||||
" Yank from the cursor to the end of the line, to be consistent with C and D.
|
" Yank from the cursor to the end of the line, to be consistent with C and D.
|
||||||
nnoremap Y y$
|
nnoremap Y y$
|
||||||
|
|
||||||
set foldmethod=syntax
|
if has('nvim')
|
||||||
autocmd FileType python set foldmethod=indent
|
set foldmethod=expr
|
||||||
|
set foldexpr=nvim_treesitter#foldexpr()
|
||||||
|
else
|
||||||
|
set foldmethod=syntax
|
||||||
|
autocmd FileType python set foldmethod=indent
|
||||||
|
endif
|
||||||
|
|
||||||
|
" so when a buffer open it wouldn't be fold by default
|
||||||
set nofoldenable
|
set nofoldenable
|
||||||
" Code folding options
|
|
||||||
nmap <leader>f0 :set foldlevel=0<CR>
|
|
||||||
nmap <leader>f1 :set foldlevel=1<CR>
|
|
||||||
nmap <leader>f2 :set foldlevel=2<CR>
|
|
||||||
nmap <leader>f3 :set foldlevel=3<CR>
|
|
||||||
nmap <leader>f4 :set foldlevel=4<CR>
|
|
||||||
nmap <leader>f5 :set foldlevel=5<CR>
|
|
||||||
nmap <leader>f6 :set foldlevel=6<CR>
|
|
||||||
nmap <leader>f7 :set foldlevel=7<CR>
|
|
||||||
nmap <leader>f8 :set foldlevel=8<CR>
|
|
||||||
nmap <leader>f9 :set foldlevel=9<CR>
|
|
||||||
|
|
||||||
" Find merge conflict markers
|
" Find merge conflict markers
|
||||||
map <leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>
|
map <leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>
|
||||||
|
|||||||
+11
-17
@@ -38,7 +38,6 @@
|
|||||||
|
|
||||||
Plug 'scrooloose/nerdtree'
|
Plug 'scrooloose/nerdtree'
|
||||||
|
|
||||||
Plug 'godlygeek/tabular'
|
|
||||||
" for markdown{
|
" for markdown{
|
||||||
Plug 'preservim/vim-markdown'
|
Plug 'preservim/vim-markdown'
|
||||||
"}
|
"}
|
||||||
@@ -79,6 +78,9 @@
|
|||||||
" put text in neibouring tmux pane into auto complete
|
" put text in neibouring tmux pane into auto complete
|
||||||
Plug 'wellle/tmux-complete.vim'
|
Plug 'wellle/tmux-complete.vim'
|
||||||
|
|
||||||
|
Plug 'ludovicchabant/vim-gutentags'
|
||||||
|
Plug 'lambdalisue/readablefold.vim'
|
||||||
|
|
||||||
" only work with nvim > 0.5
|
" only work with nvim > 0.5
|
||||||
" For other versions, just loading the plugin may
|
" For other versions, just loading the plugin may
|
||||||
" cause error
|
" cause error
|
||||||
@@ -132,6 +134,11 @@ if g:vim_type == 'nvim'
|
|||||||
endif
|
endif
|
||||||
" }
|
" }
|
||||||
|
|
||||||
|
" ludovicchabant/vim-gutentags {
|
||||||
|
set statusline+=%{gutentags#statusline()}
|
||||||
|
let g:gutentags_cache_dir=g:vim_dir . '/.vimtags/'
|
||||||
|
"}
|
||||||
|
|
||||||
" easymotion/vim-easymotion {
|
" easymotion/vim-easymotion {
|
||||||
|
|
||||||
" <Leader>f{char} to move to {char}
|
" <Leader>f{char} to move to {char}
|
||||||
@@ -179,23 +186,10 @@ endif
|
|||||||
if isdirectory(expand(plugin_dir . "/vim-rooter"))
|
if isdirectory(expand(plugin_dir . "/vim-rooter"))
|
||||||
let g:rooter_patterns = ['.vscode', '.git', '*.sln', 'src']
|
let g:rooter_patterns = ['.vscode', '.git', '*.sln', 'src']
|
||||||
let g:rooter_change_directory_for_non_project_files = 'current'
|
let g:rooter_change_directory_for_non_project_files = 'current'
|
||||||
|
let g:rooter_silent_chdir = 1
|
||||||
endif
|
endif
|
||||||
" }
|
" }
|
||||||
|
|
||||||
" godlygeek/tabular {
|
|
||||||
if isdirectory(expand(plugin_dir . "/tabular"))
|
|
||||||
nmap <leader>t= :Tabularize /=<CR>
|
|
||||||
vmap <leader>t= :Tabularize /=<CR>
|
|
||||||
|
|
||||||
nmap <leader>t\| :Tab /\|<CR>
|
|
||||||
vmap <leader>t\| :Tab /\|<CR>
|
|
||||||
|
|
||||||
nmap <leader>t: :Tab /:\zs<CR>
|
|
||||||
vmap <leader>t: :Tab /:\zs<CR>
|
|
||||||
endif
|
|
||||||
|
|
||||||
" }
|
|
||||||
|
|
||||||
" NerdTree {
|
" NerdTree {
|
||||||
if isdirectory(expand(plugin_dir . "/nerdtree"))
|
if isdirectory(expand(plugin_dir . "/nerdtree"))
|
||||||
let g:NERDShutUp=1
|
let g:NERDShutUp=1
|
||||||
@@ -381,7 +375,7 @@ endif
|
|||||||
"if !has('nvim') || g:vim_version < 0.5
|
"if !has('nvim') || g:vim_version < 0.5
|
||||||
if v:true
|
if v:true
|
||||||
highlight SignColumn ctermbg=none
|
highlight SignColumn ctermbg=none
|
||||||
highlight CursorLineNr ctermbg=none
|
"highlight CursorLineNr ctermbg=none
|
||||||
highlight CocWarningHighlight ctermbg=none
|
highlight CocWarningHighlight ctermbg=none
|
||||||
highlight CocErrorSign ctermbg=none ctermfg=9 cterm=bold
|
highlight CocErrorSign ctermbg=none ctermfg=9 cterm=bold
|
||||||
highlight CocErrorHighlight ctermbg=none ctermfg=9 cterm=underline,bold
|
highlight CocErrorHighlight ctermbg=none ctermfg=9 cterm=underline,bold
|
||||||
@@ -391,7 +385,7 @@ endif
|
|||||||
highlight CocInfoSign ctermbg=none
|
highlight CocInfoSign ctermbg=none
|
||||||
highlight CocHintSign ctermbg=none
|
highlight CocHintSign ctermbg=none
|
||||||
if g:theme_color == 'dark'
|
if g:theme_color == 'dark'
|
||||||
highlight! link TempColor Pmenu
|
highlight! link TempColor Visual
|
||||||
highlight! link CocFloating TempColor
|
highlight! link CocFloating TempColor
|
||||||
highlight! link CocErrorFloat TempColor
|
highlight! link CocErrorFloat TempColor
|
||||||
highlight! link CocWarningFloat TempColor
|
highlight! link CocWarningFloat TempColor
|
||||||
|
|||||||
+87
@@ -0,0 +1,87 @@
|
|||||||
|
""" cross platform installation script
|
||||||
|
"""
|
||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
|
from os.path import expanduser, join
|
||||||
|
from shutil import which
|
||||||
|
|
||||||
|
home = expanduser("~")
|
||||||
|
app_name = 'dotfiles'
|
||||||
|
APP_PATH = join(home, '.' + app_name)
|
||||||
|
REPO_URL = 'https://github.com/Donaldttt/' + app_name
|
||||||
|
REPO_BRANCH = 'dev'
|
||||||
|
VIM_RTPATH = join(home, '.vim')
|
||||||
|
|
||||||
|
def exist(app):
|
||||||
|
return which(app) is not None
|
||||||
|
|
||||||
|
def program_must_exist(app):
|
||||||
|
if not exist(app):
|
||||||
|
fatal_error(app, "must be installed to continue")
|
||||||
|
|
||||||
|
def fatal_error(msg):
|
||||||
|
print('Error:', msg)
|
||||||
|
exit()
|
||||||
|
|
||||||
|
def msg(msg):
|
||||||
|
print(msg)
|
||||||
|
|
||||||
|
def execute(cmd, cwd=None):
|
||||||
|
out = subprocess.check_output(
|
||||||
|
cmd,
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
shell=True,
|
||||||
|
cwd=None
|
||||||
|
)
|
||||||
|
print(out)
|
||||||
|
|
||||||
|
def sync_repo(repo_path, repo_url, repo_branch, repo_name):
|
||||||
|
if not os.path.exists(repo_path):
|
||||||
|
msg('Trying to clone ' + repo_name)
|
||||||
|
cmd = "git clone -b {} {} {}".format(repo_branch, repo_url, repo_path)
|
||||||
|
execute(cmd)
|
||||||
|
else:
|
||||||
|
msg('Trying to update ' + repo_name)
|
||||||
|
cmd = "git pull origin {}".format(repo_branch)
|
||||||
|
execute(cmd, cwd=APP_PATH)
|
||||||
|
|
||||||
|
def setup_vimplug():
|
||||||
|
|
||||||
|
vimplug_path = VIM_RTPATH + "\\autoload\\plug.vim"
|
||||||
|
if not os.path.isdir(os.path.dirname(vimplug_path)):
|
||||||
|
os.makedirs(os.path.dirname(vimplug_path))
|
||||||
|
urllib.request.urlretrieve("https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim", vimplug_path)
|
||||||
|
print("Please execute :PlugInstall in vim")
|
||||||
|
|
||||||
|
def setup_nvim():
|
||||||
|
if exist('nvim'):
|
||||||
|
nvim_dir = home + '\\AppData\\Local\\nvim\\'
|
||||||
|
nvim_config = nvim_dir + 'init.vim'
|
||||||
|
if not os.path.isdir(nvim_dir):
|
||||||
|
os.mkdir(nvim_dir)
|
||||||
|
msg('Setting up neovim config')
|
||||||
|
with open(nvim_config, 'w') as f:
|
||||||
|
f.write('''set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
||||||
|
let &packpath=&runtimepath
|
||||||
|
source ~/.vimrc''')
|
||||||
|
|
||||||
|
def setup_vim():
|
||||||
|
if not exist('vim') and not exist('nvim'):
|
||||||
|
fatal_error('Error: vim or nvim has to be installed.')
|
||||||
|
program_must_exist('git')
|
||||||
|
sync_repo(APP_PATH, REPO_URL, REPO_BRANCH, app_name)
|
||||||
|
path = join(home, '.vimrc')
|
||||||
|
if os.path.exists(path):
|
||||||
|
os.remove(path)
|
||||||
|
os.symlink(join(APP_PATH, '.vimrc'), join(home, '.vimrc'))
|
||||||
|
path = join(home, '.vimrc.bundles')
|
||||||
|
if os.path.exists(path):
|
||||||
|
os.remove(path)
|
||||||
|
os.symlink(join(APP_PATH, '.vimrc.bundles'), join(home, '.vimrc.bundles'))
|
||||||
|
setup_nvim()
|
||||||
|
setup_vimplug()
|
||||||
|
msg("Done!")
|
||||||
|
|
||||||
|
setup_vim()
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
|
|
||||||
# Windows Tips
|
# Windows Tips
|
||||||
|
|
||||||
|
## Install vim
|
||||||
|
|
||||||
|
Probably need to install bulid tool through scoop(like gcc)
|
||||||
|
|
||||||
Config powershell as emac style
|
Config powershell as emac style
|
||||||
|
|
||||||
put this line into powershell's config file(which is in $profile)
|
put this line into powershell's config file(which is in $profile)
|
||||||
|
|||||||
Reference in New Issue
Block a user