ideaVim的配置
"" Source your .vimrc
"source ~/.vimrc
"" -- Suggested options --
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
"set scrolloff=5
" Do incremental searching.
set incsearch
" Don't use Ex mode, use Q for formatting.
map Q gq
"默认leader
let mapleader = "\"
"" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t
"" Map \r to the Reformat Code action
"map \r (ReformatCode)
"" Map d to start debug
"map d (Debug)
"" Map \b to toggle the breakpoint on the current line
"map \b (ToggleLineBreakpoint)
" Hello, world!
" Hello,,,,good world!
" Find more examples here: https://jb.gg/share-ideavimrc
"语法高亮
syntax on
"显示行号
set number relativenumber
"显示光标所在位置的行号和列号
set ruler "在右下角显示光标的位置
set wrap "自动折行
set shiftwidth=4 "转移,变动,移动 > < 移动的步进
set tabstop=4 "tab缩进,显示的空格长度
set softtabstop=4 "编辑模式按退格键时,光标回退的空格长度,即一个tab
set expandtab "将tab替换为相应数量空格
set smartindent "自动缩进,有时候并不是你想要的
set backspace=2 "启用退格键的删除功能"
set co=5 "个命令设置了autoindent和cindent选项,并将cinwidth设置为5。这意味着在代码块内,Vim将自动缩进5列"
"设置取消备份 禁止临时文件生成
set nobackup
set noswapfile
" 为IdeaVim插件增加自动切换为英文输入法的功能,
" idea 需要安装 IdeaVimExtension plugin
set keep-english-in-normal
"设置匹配模式 类似当输入一个左括号时会匹配相应的那个右括号
set showmatch
"共享剪切板,Vim 的剪切板和系统的剪切板是隔离的。设置之后可以共享。
" set clipboard+=unnamedplus
" set clipboard^=unnamed,unnamedplus
"set laststatus=2 "命令行为两行
"set fenc=utf-8 "文件编码
"set mouse=a "启用鼠标
set mouse=""
"monse =true
set mouse=""
"set ignorecase "忽略大小写
set cursorline "突出显示当前行
"set cursorcolumn "突出显示当前列
set fdm=marker
"显示工具栏
"set guioptions-=T
set guioptions+=T
"jk退出insert模式
inoremap jk
nnoremap gl $
nnoremap gh ^
nnoremap a 0
"Idea action 配置
" 重命令元素
nnoremap re :action RenameElement
nnoremap gi :action GotoImplementation
"nnoremap im :action ImplementMethods
"nnoremap rv :action IntroduceVariable
"nnoremap cr :action CopyReference
"nnoremap em :action ExtractMethod
"nnoremap sw :action SurroundWith
"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
"noremap
"noremap
"noremap
"noremap
"noremap
"noremap
"noremap
"noremap
"noremap
"noremap
"noremap
"noremap
"总是显示状态栏
set laststatus=1
"状态行显示的内容 statue
"set statusline=%a%n\ %F\%m%r%w\ \ %{''.(&fenc!=''?&fenc:&enc).''}\ %{(&bomb?\",BOM\":\"\")}\ [%l,%v][%p%%]
" 不保存不提示
set hidden
"高亮
syntax enable " 开启语法高亮功能
"syntax on
set number
"相对行号
set relativenumber
"set norelativenumber
"显示状态select模式下显示选中的行数
set showcmd
" 搜索高亮
set hlsearch
exec "nohlsearch"
"组合键要连续快速"
nnoremap :nohlsearch
"搜索实时预览
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 :set paste
"nnoremap :set autoindent
"show tab
set showtabline=2
"自动换行
set wrap
set tw=0
nnoremap n :set nowrap
nnoremap N :set wrap
nnoremap sp :set paste
nnoremap sP :set nopaste
"操作:za,打开或关闭当前折叠;zM,关闭所有折叠;zR,打开所有折叠
"indent方式,vim会自动利用缩进进行折叠,我们可以使用现成的折叠成果.
"我们可以在(括号)折叠处输入以下命令:
"zc 折叠
"zC 对所在范围内所有嵌套的折叠点进行折叠
"zo 展开折叠
"zO 对所在范围内所有嵌套的折叠点展开
"[z 到当前打开的折叠的开始处。
"]z 到当前打开的折叠的末尾处。
"zj 向下移动。到达下一个折叠的开始处。关闭的折叠也被计入。
"zk 向上移动到前一折叠的结束处。关闭的折叠也被计入。
"折叠方式 indent 所有 diff无更改折叠 syntax marker manual手动
set foldmethod=indent
nnoremap zc2 :set foldlevel=2
nnoremap zc3 :set foldlevel=3
nnoremap zc4 :set foldlevel=4
nnoremap zc5 :set foldlevel=5
nnoremap zC :set foldlevel=99
"开启折叠
set foldlevel=99
set foldenable
"关闭折叠
"set nofoldenable
"nnoremap @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')
"Fill space between windows 在被分割的窗口间显示空白,便于阅读
set fillchars=vert:\ ,stl:\ ,stlnc:\
"显示标尺 :statusBar态行上显示光标所在位置的行号和列号
"set ruler
set rulerformat=%20(%2*%<%f%=\ %m%r\ %3l\ %c\ %p%%%)
"缩进
"map >>
"map <
" key notation
"
" 不是leader键不管用, 是我按键的时候太慢了,导致没有触发成功
"行首 行未
"nnoremap a 0
"nnoremap ' $
"nnoremap l 0
"inoremap jk
"vnoremap jk
"分屏
nmap sv :set splitright:vsplit
nmap ss :set splitbelow:split
nnoremap h
nnoremap j
nnoremap k
nnoremap l
"nmap h h
"nmap j j
"nmap k k
"nmap l l
nmap :res +5
nmap :res -5
nmap :vertical resize+5
nmap :vertical resize-5
"快速移动
" nmap J 4j
nmap K 4k
nmap H 4h
nmap L 4l
vnoremap J 4j
vnoremap K 4k
vnoremap H 4h
vnoremap L 4l
inoremap
inoremap
inoremap
inoremap
inoremap
inoremap
"inoremap
inoremap
"vnoremap
"vnoremap
nnoremap 30j
nnoremap b 30
"只有复制动作才同步到系统剪贴板,可以通过自定义映射来实现
nnoremap y "+y
vnoremap y "+y
"快速复制粘贴
vnoremap c "+y
vnoremap 1y "9y
vnoremap 2y "8y
vnoremap v "+p
vnoremap x "+x
nnoremap 1p "9p
nnoremap 2p "8p
nnoremap o "0p
nnoremap c viw"+y
nnoremap y viw"0y
" nnoremap v "+p
nnoremap v viw"+p
nnoremap p "+p
nnoremap d "_diw
nnoremap x viwc
" 普通模式下快速搜索复制的内容,不稳定,有时可能会无效
" test nnoremap /+
inoremap +
" cnoremap:表示在命令行模式(包括搜索模式)下定义映射。
" 如果你想定义一个快捷键来自动插入某个寄存器的内容,可以通过 Vim 的映射功能模拟输入。例如:
cnoremap +
"多文件切换"
nnoremap :bn
nnoremap l :tabn
nnoremap h :tabprev
" 映射 Find 功能
nmap f :action Find
"如何触发多行光标,
"
function! CopyCode()
:set paste
:"+p
:set nopaste
"silent! call PhpCsFixerFixFile()
endfunction
"imap "+gP
"map "+p
"noremap i H
"回车键映射为空行"
nmap o
"保存文件
map S :w
"禁用s删除
map s
"推出
map Q :q
"刷新
map R :source ~/.config/nvim/init.vim
map E :e
" 取消行号
"map N :set nu
"map n :set nonu
"fzf
"nnoremap f :Files
"nnoremap F :Rg
"nnoremap t :Lines
"nnoremap h :History
"nnoremap b :Buffers
"tab切换
nnoremap bl :bn
nnoremap bd :call BufferDel()
"tab切换
nnoremap bh :bp
function! BufferDel()
:bp|bd #
"silent! call PhpCsFixerFixFile()
endfunction
"copy path
"nnoremap p :let @+=expand('%:p')
"nnoremap P :let @+=expand('%:t')
"复制当前文件的绝对路径
"noremap p :action CopyAbsolutePath
"复制当前文件名
"noremap P :action CopyContentRootPath
"svn
"nmap su :!svn up
"nmap si :call Svnci()
"nmap sd :!svn diff %
"nmap go :!git checkout %
"nmap sr :!svn revert %
"nmap st :!svn st %
"" reload
set idearefactormode=keep
set ideajoin
"打开报错, AceJump已经集成了,再打开无法识别, 并且会导致ideavim插件失效"
"set easymotion
"nmap s (easymotion-sn)
"nmap w (easymotion-overwin-w)
"set NERDTree
"map tt :NERDTreeToggle
"map tf :NERDTreeFind
"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
""" 避免了键与Navigate导航栏的按键冲突
nmap NextWholeOccurrence
xmap NextWholeOccurrence
" nmap g NextOccurrence
" xmap g NextOccurrence
" nmap SkipOccurrence
" xmap SkipOccurrence
" nmap RemoveOccurrence
" xmap RemoveOccurrence
"let multi_cursor_use_default_mapping=0
"let multi_cursor_next_key=''
"let multi_cursor_prev_key=''
"let multi_cursor_skip_key=''
"let multi_cursor_quit_key=''
" 重构重命名
"nnoremap r :action RenameElement
" 格式化当前文件
"nnoremap cf :action ReformatCode
"文件跳转
"noremap tf mm`m:action GotoFile
" quick java doc
"nnoremap q :action QuickJavaDoc
"搜索任何位置 b
"noremap f :action SearchEverywhere
"文本搜索
"noremap B :action FindInPath
"打开最新文件列表
"noremap