"basemap
"source $cnfpath/nvim/cnf/basemap.vim
"""""""""""""""""""""
" 自动设置
"""""""""""""""""""""
"""""""""""""""""""""
" 通用设置
"""""""""""""""""""""
"解决中文输入法
"在ibus里面添加代码 .config/ibus/rime/build/stroke.schema.yaml
"识别不同的文件格式
set nocompatible "is support old vim
filetype on
filetype indent on
filetype plugin on
filetype plugin indent on
autocmd FileType text setlocal textwidth=78
"monse =true
set mouse=""
"noremap <ScrollWheelUp> <nop>
"noremap <S-ScrollWheelUp> <nop>
"noremap <C-ScrollWheelUp> <nop>
"noremap <ScrollWheelDown> <nop>
"noremap <S-ScrollWheelDown> <nop>
"noremap <C-ScrollWheelDown> <nop>
"noremap <ScrollWheelLeft> <nop>
"noremap <S-ScrollWheelLeft> <nop>
"noremap <C-ScrollWheelLeft> <nop>
"noremap <ScrollWheelRight> <nop>
"noremap <S-ScrollWheelRight> <nop>
"noremap <C-ScrollWheelRight> <nop>
"总是显示状态栏
set laststatus=1
"状态行显示的内容 statue
"set statusline=%a%n\ %F\%m%r%w\ \ %{''.(&fenc!=''?&fenc:&enc).''}\ %{(&bomb?\",BOM\":\"\")}\ [%l,%v][%p%%]
" 不保存不提示
set hidden
"默认leader
"let mapleader = "\<Space>"
let mapleader = ";"
"高亮
syntax enable " 开启语法高亮功能
"syntax on
set number
"相对行号
set relativenumber
"set norelativenumber
"显示状态select模式下显示选中的行数
set showcmd
" 搜索高亮
set hlsearch
exec "nohlsearch"
nnoremap <Space><CR> :nohlsearch<CR>
"搜索实时预览
set incsearch
"忽略大小写
set ignorecase
"set noignorecase
"智能大小写
"set smartcase
"使光标始终和上下边缘相距3行
set scrolloff=8
"按键间隔 change key wait time neterror
"set notimeout
set timeoutlen=500
set viewoptions=cursor,folds,slash,unix
"注释
set formatoptions=tcrqn
"分平
set splitright
set splitbelow
"关闭显示模式 IVNC statusbar
set noshowmode
"启动画面
set shortmess+=c
"优化滚动性能
"set ttyfast
"在执行宏命令时,不进行显示重绘;在宏命令执行完成后,一次性重绘,以便提高性能。
set lazyredraw
"bell
set visualbell
"列长度标尺
set colorcolumn=80
"自动更新时间
set updatetime=1000
"允许光标出现在最后一个字符的后面
set virtualedit=block
"记录光标配置
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"状态列的行数,预设一行,建议设成两行
set cmdheight=2
"与windows共享剪贴板
"set clipboard+=unnamed
set history=10
"""""""""""""""""""""
" 排版设置
"""""""""""""""""""""
" tab-py
set expandtab
"把制表符显示为^I ,用$标示行尾 TAB会被显示成 ">---" 而行尾多余的空白字符显示成 "-"
set list
set listchars=tab:>-,trail:-
set indentexpr=
" 退格不换行 del any
set backspace=indent,eol,start
" 下线
set cursorline
"当设置成 expandtab 时,缩进用空格来表示,noexpandtab 则是用制表符表示一个缩进
set expandtab
" vim中默认的缩进为8个空格 set ts=4
set tabstop=4
set shiftwidth=4
set softtabstop=4
"自动缩进
set autoindent
"set paste
set nopaste
"nnoremap <F7> :set paste<CR>
"nnoremap <F8> :set autoindent<CR>
"show tab
set showtabline=2
"自动换行
set wrap
set tw=0
nnoremap <Space>n :set nowrap<CR>
nnoremap <Space>N :set wrap<CR>
nnoremap <leader>sp :set paste<CR>
nnoremap <leader>sP :set nopaste<CR>
"操作:za,打开或关闭当前折叠;zM,关闭所有折叠;zR,打开所有折叠
"indent方式,vim会自动利用缩进进行折叠,我们可以使用现成的折叠成果.
"我们可以在(括号)折叠处输入以下命令:
"zc 折叠
"zC 对所在范围内所有嵌套的折叠点进行折叠
"zo 展开折叠
"zO 对所在范围内所有嵌套的折叠点展开
"[z 到当前打开的折叠的开始处。
"]z 到当前打开的折叠的末尾处。
"zj 向下移动。到达下一个折叠的开始处。关闭的折叠也被计入。
"zk 向上移动到前一折叠的结束处。关闭的折叠也被计入。
"折叠方式 indent 所有 diff无更改折叠 syntax marker manual手动
set foldmethod=indent
nnoremap <leader>zc2 :set foldlevel=2<CR>
nnoremap <leader>zc3 :set foldlevel=3<CR>
nnoremap <leader>zc4 :set foldlevel=4<CR>
nnoremap <leader>zc5 :set foldlevel=5<CR>
nnoremap <leader>zC :set foldlevel=99<CR>
"开启折叠
set foldlevel=99
set foldenable
"关闭折叠
"set nofoldenable
"nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
"Fill space between windows 在被分割的窗口间显示空白,便于阅读
set fillchars=vert:\ ,stl:\ ,stlnc:\
"显示标尺 :statusBar态行上显示光标所在位置的行号和列号
"set ruler
set rulerformat=%20(%2*%<%f%=\ %m%r\ %3l\ %c\ %p%%%)
"缩进
"map <Tab> >>
"map <S-Tab> <
" key notation
"
"行首 行未
"nnoremap <leader>a 0
nnoremap <leader>' $
nnoremap <leader>l 0
inoremap jk <ESC>
"vnoremap jk <ESC>
"分屏
"nmap sv :set splitright<CR>:vsplit<CR>
"nmap ss :set splitbelow<CR>:split<CR>
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
"nmap <space>h <C-w>h
"nmap <space>j <C-w>j
"nmap <space>k <C-w>k
"nmap <space>l <C-w>l
nmap <DOWN> :res +5<CR>
nmap <UP> :res -5<CR>
nmap <RIGHT> :vertical resize+5<CR>
nmap <LEFT> :vertical resize-5<CR>
"快速移动
nmap J 5j
nmap K 5k
nmap H 5h
nmap L 5l
inoremap <C-h> <Left>
inoremap <C-l> <Right>
inoremap <C-k> <Up>
inoremap <C-j> <Down>
inoremap <C-b> <PageUp>
inoremap <C-f> <PageDown>
"inoremap <C-d> <DELETE>
inoremap <C-d> <Backspace>
"快速复制
vnoremap <space>c "+y
vnoremap <space>1y "9y
vnoremap <space>2y "8y
nnoremap <space>1p "9p
nnoremap <space>2p "8p
nnoremap <space>o "0p
vnoremap <space>v "+p
vnoremap <space>x "+x
nnoremap <space>c viw"+y
nnoremap <space>p diwh"+p
function! CopyCode()
:set paste
:"+p
:set nopaste
"silent! call PhpCsFixerFixFile()
endfunction
nnoremap <space>p diwh"+p
"imap <C-V> "+gP
"map <C-V> "+p
"noremap i H
"保存文件
map S :w<CR>
"禁用s删除
map s <nop>
"推出
map Q :q<CR>
"刷新
map <Leader>R :source ~/.config/nvim/init.vim<CR>
map E :e<CR>
" 取消行号
"map N :set nu<CR>
"map n :set nonu<CR>
"fzf
"nnoremap <Leader>f :Files<CR>
"nnoremap <Leader>F :Rg<CR>
"nnoremap <Leader>t :Lines<CR>
"nnoremap <Leader>h :History<CR>
"nnoremap <Leader>b :Buffers<CR>
"tab切换
nnoremap bl :bn<CR>
nnoremap bd :call BufferDel()<CR>
"tab切换
nnoremap bh :bp<CR>
function! BufferDel()
:bp|bd #
"silent! call PhpCsFixerFixFile()
endfunction
"copy path
"nnoremap <Leader>p :let @+=expand('%:p')<CR>
"nnoremap <Leader>P :let @+=expand('%:t')<CR>
"复制当前文件的绝对路径
noremap <Leader>p :action CopyAbsolutePath<CR>
"复制当前文件名
noremap <Leader>P :action CopyContentRootPath<CR>
"svn
nmap <Leader>su :!svn up<CR>
nmap <Leader>si :call Svnci()<CR>
nmap <Leader>sd :!svn diff %<CR>
nmap <Leader>go :!git checkout %<CR>
nmap <Leader>sr :!svn revert %<CR>
nmap <Leader>st :!svn st %<CR>
"" vim en chinese
set keep-english-in-normal
"set keep-english-in-normal-and-restore-in-insert
"" reload
set idearefactormode=keep
set ideajoin
set easymotion
nmap <leader>s <Plug>(easymotion-sn)
nmap <Leader>w <Plug>(easymotion-overwin-w)
set NERDTree
map tt :NERDTreeToggle<CR>
map tf :NERDTreeFind<CR>
let NERDTreeMapOpenExpl = ""
let NERDTreeMapUpdir = ""
let NERDTreeMapUpdirKeepOpen = ""
let NERDTreeMapOpenSplit = "s"
let NERDTreeOpenVSplit = "v"
let NERDTreeMapActivateNode = "l"
let NERDTreeMapOpenInTab = "t"
let NERDTreeMapPreview = "p"
let NERDTreeMapCloseDir = "h"
let NERDTreeMapChangeRoot = "r"
set surround
" cia
set argtextobj
"set visual-multi
set multiple-cursors
""" remap multiple-cursors
""" 避免了<A-n>键与Navigate导航栏的按键冲突
nmap <C-n> <Plug>NextWholeOccurrence
xmap <C-n> <Plug>NextWholeOccurrence
" nmap g<C-A-n> <Plug>NextOccurrence
" xmap g<C-A-n> <Plug>NextOccurrence
" nmap <C-x> <Plug>SkipOccurrence
" xmap <C-x> <Plug>SkipOccurrence
" nmap <C-p> <Plug>RemoveOccurrence
" xmap <C-p> <Plug>RemoveOccurrence
"let multi_cursor_use_default_mapping=0
"let multi_cursor_next_key='<C-n>'
"let multi_cursor_prev_key='<C-p>'
"let multi_cursor_skip_key='<C-x>'
"let multi_cursor_quit_key='<Esc>'
" 重构重命名
nnoremap <leader>r :action RenameElement<CR>
" 格式化当前文件
nnoremap <leader>cf :action ReformatCode<CR><esc>
"文件跳转
"noremap <Space>tf mm`m:action GotoFile<CR>
" quick java doc
nnoremap <leader>q :action QuickJavaDoc<CR>
"搜索任何位置 b
noremap <Leader>f :action SearchEverywhere<CR>
"文本搜索
noremap <Leader>B :action FindInPath<CR>
"打开最新文件列表
noremap <Leader>b :action RecentFiles<CR>
"改变视图symotion-sn)
"nnoremap <Space>cv :action ChangeView<CR>
"debug神器
"nmap <C-j> :action StepOver<CR>
"nmap <C-k> :action Resume<CR>
"nmap <C-h> :action StepOut<CR>
"nmap <C-l> :action ForceStepInto<CR>
"跳转 需要安装AceJump插d大幅度件
"noremap <Space>tj mm`m:action AceWordAction<CR>
"noremap <Space>jp mm`m:action AceDeclarationAction<CR>
"跳转下个报错处
noremap <Leader>ne mm`m:action GotoNextError<CR>
"跳转上个报错处
noremap <Leader>pe mm`m:action GotoPreviousError<CR>
"java类跳转
"noremap <Space>tc mm`m:action GotoClass<CR>
"从子类方法跳到父类的方法
"noremap <Space>gs mm`m:action GotoSuperMethod<CR>
"跳到方法实现
noremap <Leader>ii mm`m:action GotoImplementation<CR>
"跳回方法实现
noremap <Leader>ij mm`m:action GotoDeclaration<CR>
"new function
noremap <Leader>nf mm`m:action ExtractMethod<CR>
"new code block
noremap <Leader>sw mm`m:action SurroundWith<CR>
"noremap <Leader>im mm`m:action ImplementMethods<CR>
"万能重构"
"打开函数列表
noremap <Leader>T mm`m:action ActivateStructureToolWindow<CR>
noremap <Leader>u mm`m:action LocalHistory<CR>
"Ter common+T