improve structure

This commit is contained in:
Nachuan Tang
2022-07-23 00:13:04 -04:00
parent b81b03b871
commit 3fe74cc96b
3 changed files with 59 additions and 88 deletions
+18 -59
View File
@@ -7,12 +7,6 @@
" }
" Use bundles config {
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
" }
" General {
set background=dark " Assume a dark background
@@ -33,26 +27,21 @@
filetype plugin indent on " Automatically detect file types.
syntax on " Syntax highlighting
syntax enable " Syntax highlighting
set mouse=a " Automatically enable mouse usage
"set mouse=a " Automatically enable mouse usage
set mousehide " Hide the mouse cursor while typing
scriptencoding utf-8
" Most prefer to automatically switch to the current file directory when
" a new buffer is opened; to prevent this behavior, add the following to
" your .vimrc.before.local file:
" let g:spf13_no_autochdir = 1
if !exists('g:spf13_no_autochdir')
autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9\]*://" | lcd %:p:h | endif
" Always switch to the current file directory
endif
" a new buffer is opened;
autocmd BufEnter * if bufname("") !~ "^\[A-Za-z0-9\]*://" | lcd %:p:h | endif
" Always switch to the current file directory
set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
set viewoptions=folds,options,cursor,unix,slash " Better Unix / Windows compatibility
set virtualedit=onemore " Allow for cursor beyond last character
set history=1000 " Store a ton of history (default is 20)
set spell " Spell checking on
set nospell " Spell checking off
set hidden " Allow buffer switching without saving
set iskeyword-=. " '.' is an end of word designator
set iskeyword-=# " '#' is an end of word designator
@@ -65,9 +54,6 @@
" http://vim.wikia.com/wiki/Restore_cursor_to_file_position_in_previous_editing_session
" Restore cursor to file position in previous editing session
" To disable this, add the following to your .vimrc file:
" let g:spf13_no_restore_cursor = 1
if !exists('g:spf13_no_restore_cursor')
function! ResCur()
if line("'\"") <= line("$")
silent! normal! g`"
@@ -79,7 +65,6 @@
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END
endif
" Setting up the directories {
set backup " Backups are nice ...
@@ -93,22 +78,13 @@
" }
" Vim UI {
if filereadable(expand("~/.vim/plugged/vim-colors-solarized/colors/solarized.vim"))
let g:solarized_termcolors=256
let g:solarized_termtrans=1
let g:solarized_contrast="normal"
let g:solarized_visibility="normal"
call togglebg#map("<F5>")
colorscheme solarized
endif
"
set tabpagemax=15 " Only show 15 tabs
set showmode " Display the current mode
set cursorline " Highlight current line
highlight clear SignColumn " SignColumn should match background
highlight clear LineNr " Current line number row will have same background color in relative mode
"highlight clear SignColumn " SignColumn should match background
"highlight clear LineNr " Current line number row will have same background color in relative mode
"highlight clear CursorLineNr " Remove highlight color from current line number
if has('cmdline_info')
@@ -160,15 +136,9 @@
set matchpairs+=<:> " Match, to be used with %
set comments=sl:/*,mb:*,elx:*/ " auto format comment blocks
" Remove trailing whitespaces and ^M chars
" To disable the stripping of whitespace, add the following to your
" .vimrc.before.local file:
" let g:spf13_keep_trailing_whitespace = 1
"autocmd FileType c,cpp,java,go,php,javascript,puppet,python,rust,twig,xml,yml,perl,sql autocmd BufWritePre <buffer> if !exists('g:spf13_keep_trailing_whitespace') | call StripTrailingWhitespace() | endif
"autocmd FileType go autocmd BufWritePre <buffer> Fmt
autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
autocmd FileType haskell,puppet,ruby,yml setlocal expandtab shiftwidth=2 softtabstop=2
" preceding line best in a plugin but here for now.
autocmd BufNewFile,BufRead *.coffee set filetype=coffee
@@ -181,12 +151,10 @@
" Key (re)Mappings {
" Wrapped lines goes down/up to next row, rather than next line in file.
noremap j gj
noremap k gk
" Stupid shift key fixes
if !exists('g:spf13_no_keyfixes')
if has("user_commands")
@@ -337,20 +305,6 @@
endfunction
" }
" Strip whitespace {
function! StripTrailingWhitespace()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" do the business:
%s/\s\+$//e
" clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
" }
" Shell command {
function! s:RunShellCommand(cmdline)
botright new
@@ -367,7 +321,6 @@
call setline(2, substitute(a:cmdline, '.', '=', 'g'))
execute 'silent $read !' . escape(a:cmdline, '%#')
setlocal nomodifiable
1
endfunction
command! -complete=file -nargs=+ Shell call s:RunShellCommand(<q-args>)
@@ -407,11 +360,11 @@
" TIPS: :hi can be used to check current highlight options
" Coc has wired floating color, this is an attempt to fix it
highlight CocFloating ctermbg=green
highlight FgCocErrorFloatBgCocFloating cterm=bold ctermfg=124 guifg=DarkRed ctermbg=green
" highlight CocFloating ctermbg=green
" highlight FgCocErrorFloatBgCocFloating cterm=bold ctermfg=124 guifg=DarkRed ctermbg=green
" c highlight fix
highlight cComment ctermfg=12 guifg=#458588
" highlight cComment ctermfg=12 guifg=#458588
" copy to system
set clipboard=unnamed
@@ -431,3 +384,9 @@
exec "set t_PE=\e[201~"
endif
" Use bundles config {
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
" }
+36 -16
View File
@@ -2,15 +2,8 @@
" Basics {
set nocompatible " Must be first line
" }
" }
" Deps {
"Plug 'MarcWeber/vim-addon-mw-utils'
"Plug 'tomtom/tlib_vim'
" }
"
" Plugin directory
let plugin_dir = '~/.vim/plugged/'
@@ -31,15 +24,18 @@
Plug 'alvan/vim-closetag'
let g:closetag_filenames = '*.html,*.xhtml,*.phtml, *.js'
" }
"{
Plug 'altercation/vim-colors-solarized'
"Plug 'lifepillar/vim-solarized8'
"Plug 'spf13/vim-colors'
"}
Plug 'scrooloose/nerdtree'
" for markdown{
Plug 'godlygeek/tabular'
Plug 'preservim/vim-markdown'
"}
" for window resize{
Plug 'simeji/winresizer'
let g:winresizer_start_key = '<C-r>'
@@ -58,7 +54,7 @@
Plug 'mg979/vim-visual-multi'
" }
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
"Plug 'vim-airline/vim-airline-themes'
" For nvim-bufferline
" {
@@ -73,15 +69,20 @@
if executable('fzf')
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
endif
Plug 'projekt0n/github-nvim-theme'
Plug 'nanotech/jellybeans.vim'
call plug#end()
" Plugin Preferences
"
" {
" NerdTree {
if isdirectory(expand(plugin_dir . "/nerdtree"))
let g:NERDShutUp=1
nnoremap <C-e> :NERDTreeToggle<CR>
nmap <leader>e :NERDTreeFind<CR>
nnoremap <leader>e :NERDTreeToggle<CR>
"nmap <leader>e :NERDTreeFind<CR>
let NERDTreeShowBookmarks=1
"let NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
@@ -116,10 +117,9 @@
let g:airline_section_y = ''
if isdirectory(expand(plugin_dir . "/vim-airline-themes/"))
if !exists('g:airline_theme')
let g:airline_theme = 'solarized'
endif
"let g:airline_theme = 'solarized'
endif
" }
" junegunnjunegunn/fzf {
" [Buffers] Jump to the existing window if possible
@@ -128,4 +128,24 @@
noremap <leader>f :FZF<CR>
" }
" }
" {
"projekt0n/github-nvim-theme
" has('nvim') check if it's running on nvim rather than
" having neovim on your machine
if isdirectory(expand(plugin_dir . "/github-nvim-theme")) && has('nvim')
let g:github_function_style = "italic"
let g:github_sidebars = ["qf", "vista_kind", "terminal", "packer"]
set background=dark
colorscheme github_dark
endif
" }
" {
" nanotech/jellybeans.vim
if isdirectory(expand(plugin_dir . "/jellybeans.vim")) && !has('nvim')
colorscheme jellybeans
endif
" }
" }
+5 -13
View File
@@ -1,11 +1,11 @@
REM This script is for configurating vim on windows 10 machine
REM
:: This script is for configurating vim on windows 10 machine
@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%
@set NVIM_CONFIG_PATH=%HOME%\appdata\local\nvim\init.vim
@set APP_PATH=%HOME%\.dotfiles
IF NOT EXIST "%APP_PATH%" (
call git clone "https://github.com/Donaldttt/dotfiles" "%APP_PATH%"
) ELSE (
@@ -17,23 +17,15 @@ IF NOT EXIST "%APP_PATH%" (
call cd "%APP_PATH%"
)
:: Install vim-plug
curl -fLo %HOME%/vimfiles/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
call mklink "%HOME%\.vimrc" "%APP_PATH%\.vimrc"
call mklink "%HOME%\.vimrc.bundles" "%APP_PATH%\.vimrc.bundles"
IF NOT EXIST "%APP_PATH%\.vim" (
call mkdir "%APP_PATH%\.vim"
)
IF NOT EXIST "%APP_PATH%\.vim\bundle" (
call mkdir "%APP_PATH%\.vim\bundle"
)
IF NOT EXIST "%HOME%/.vim/bundle/vundle" (
call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle"
) ELSE (
call cd "%HOME%/.vim/bundle/vundle"
call git pull
call cd %HOME%
)
if exist "%NVIM_CONFIG_PATH%" (
move "%NVIM_CONFIG_PATH%" "%NVIM_CONFIG_PATH%.backup""