" ---------------------------------------------------------------------------
" operational settings
set nocompatible " vim defaults, not vi!
syntax on " syntax on
syntax enable
set hidden " allow editing multiple unsaved buffers
set more " the 'more' prompt
filetype on " automatic file type detection
filetype plugin indent on " 打开对文件类型插件的支持
set autoread " watch for file changes by other programs
set visualbell " visual beep
set backup " produce *~ backup files
set backupext=~ " add ~ to the end of backup files
":set patchmode=~ " only produce *~ if not there
set noautowrite " don't automatically write on :next, etc
"let maplocalleader=',' " all my macros start with ,
set wildmenu " display menu, when input command
set wildmode=list:longest " display cmd only as list
"set wildmode=list,full " display cmd as list and full display
set scrolloff=5 " keep at least 5 lines above/below cursor
set sidescrolloff=5 " keep at least 5 columns left/right of cursor
"//回车后下一行的起始处自动添加 //
"/*回车后,下一行的起始处自动添加*
:set fo=r
"----individual--------------------------------------------------------
set number
set hlsearch
set go=e
" let g:previous_tab = 1
" autocmd TabLeave * let g:previous_tab = tabpagenr()
" map <c-tab> :tabnext <c-r>=g:previous_tab<cr><cr>
colo evening
" 显示tab和空格
set list
set listchars=tab:>-,trail:.
" window spacing
set cmdheight=1
" 共享外部剪贴板
set clipboard+=unnamed
" 显示未完成命令
set showcmd
" 高亮当前行
set cursorline
" 记录历史行数
set history=1024
" 1. vim使用自动对齐,即把当前行对齐的格式应用到下行
" 2. 依据上面对齐的格式,智能选择对齐方式
set autoindent
set smartindent
" 编译过程中,右下角显示光标位置的状态行
set ruler
" 设置匹配模式,如输入左括号时匹配右括号
set showmatch
" 查询自动匹配单词
set incsearch
"c language indent method
"when meet ';' autoindent
"otherwise move 1 tab next line
"for file, it is no meaning.
"set cindent
" tabstop: tab宽度,默认显示tab键为4个空格
set ts=4
" shiftwidth 设置缩进的长度,为兼容一般为4
set sw=4
"按一次backspace就删除4个空格了
set smarttab
"编辑时将所有tab替换为空格
set expandtab
set ai
" 自动补全括号,包括大括号
"a<tab><tab>/* */<ESC>hhi
inoremap ;; <ESC>
"inoremap ' ''<ESC>i
"inoremap " ""<ESC>i
"inoremap ( ()<ESC>i
"inoremap /l /* */<ESC>hhi
"inoremap /a <ESC>$a<tab><tab>/* */<ESC>hhi
":inoremap ) <c-r>=ClosePair(')')<CR>
"inoremap { {}<ESC>i
":inoremap } <c-r>=ClosePair('}')<CR>
"inoremap [ []<ESC>i
":inoremap ] <c-r>=ClosePair(']')<CR>
"inoremap < <><ESC>i
":inoremap > <c-r>=ClosePair('>')<CR>
"set spell
"set spell spelllang=en_us
setlocal spell spelllang=en
" set foldmethed
set fdm=indent "foldmethed
"set fdm=syntax
" display fold flag with - or +
set foldcolumn=2
" when open file, do NOT fold code by default
set foldlevelstart=99
" source $MYVIMRC reloads the saved $MYVIMRC
:nmap <Leader>s :source $MYVIMRC <CR>
" opens $MYVIMRC for editing, or use :tabedit $MYVIMRC
:nmap <Leader>v :e $MYVIMRC <CR>
" set space for opening or closing folding
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
" key-mapping
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
nmap <F8> :Vimwiki2HTML<CR>
nmap <S-F8> :VimwikiAll2HTML<CR>
" Add for TxtBrower
" syntax on "syntax highlighting on
filetype plugin on
au BufEnter *.txt setlocal ft=txt
" Vimwiki
" mouse map
"let g:vimwiki_use_mouse = 1
" 不要将驼峰式词组作为Wiki词条
"let g:vimwiki_camel_case = 0
" set path
"let g:vimwiki_list = [{
"\ 'path': 'D:/tools/Vim/wiki',
"\ 'path_html': 'D:/tools/Vim/wiki/html/',
"\ 'template_path': 'D:/tools/Vim/wiki/templates/',
"\ 'template_default': 'def_template',
"\ 'auto_export': 1,}]
" vimwiki
"
" 是否在词条文件保存时就输出html 这个会让保存大词条比较慢
" 所以我默认没有启用 有需要的话就把这一行复制到下面去
" \ 'auto_export': 1,
" 维基项目的配置
let g:vimwiki_list = [{'path': 'D:/tools/Vim/vimfiles/_wiki_source/',
\ 'path_html': 'D:/tools/Vim/vimfiles/wiki_html/',
\ 'css_name': 'style.css'
\ },
\ {'path': 'D:/tools/Vim/vimfiles/wiki_test/'}]
let g:vimwiki_hl_headers = 1
" *.css in current path
"\ 'css_name': 'style.css'
"\ 'html_header': 'D:/tools/Vim/vimfiles/autoload/vimwiki/default.tpl',
"\ 'html_footer': 'D:/tools/Vim/vimfiles/autoload/vimwiki/default.tpl',
"
"\ 'template_path': 'D:/tools/Vim/vimfiles/autoload/vimwiki/',
"\ 'template_default': 'default',
" let g:vimwiki_html_header_numbering = 2
" let g:vimwiki_html_header_numbering_sym = '.'
let g:vimwiki_valid_html_tags='strong,em,del,blockquote,ins,code'
"let g:vimwiki_customwiki2html=$HOME.'/.vim/bundle/vimwiki/autoload/vimwiki/customwiki2html.sh'
"let g:vimwiki_browsers = ['google-chrome']
"map <leader>tl <Plug>VimwikiToggleListItem
let g:vimwiki_list_ignore_newline = 1
" 对中文用户来说,我们并不怎么需要驼峰英文成为维基词条
let g:vimwiki_camel_case = 0
" 标记为完成的 checklist 项目会有特别的颜色
"let g:vimwiki_hl_cb_checked = 1
" 我的 vim 是没有菜单的,加一个 vimwiki 菜单项也没有意义
" let g:vimwiki_menu = ''
" 是否开启按语法折叠 会让文件比较慢
"let g:vimwiki_folding = 1
" 是否在计算字串长度时用特别考虑中文字符
"let g:vimwiki_CJK_length = 1
" 支援html标记符
"let g:vimwiki_valid_html_tags='b,i,s,u,sub,sup,kbd,del,br,hr,div,code,h1'
" ======================= function =======================
:nmap <F4> :call AddUnderline()<CR>
:function! AddUnderline()
: let k = search('==\+\|--\+')
: if k > 0
: let chkType = getline(k)
: call setpos('.',[0,(k-1),1,0])
: let col = virtcol("$")
: if chkType[0] == '='
: call setline(k, repeat('=', (col-1)))
: elseif chkType[0] == '-'
: call setline(k, repeat('-', (col-1)))
: endif
: call setpos('.',[0,k,1,0])
: endif
:endfunction
Vim settings(.vimrc or _vimrc)
最新推荐文章于 2022-06-24 18:36:08 发布