VIM을 사용하여 기존 세션을 열면 set nohlsearch
마지막 설정이 작동하지 않습니다 ~/.vimrc
. 수동으로 실행하는 경우에만 작동합니다. 또한 세션에 없는 파일을 열면 설정이 ~/.vimrc
적용되는 것도 확인했습니다. 세션에서 버퍼로 전환하고 :source $MYVIMRC
.
세션을 다시 생성했지만 :mksession!
도움이 되지 않았습니다. VIM 7.4를 사용하고 있습니다.
아래는 다음과 같습니다 ~/.vimrc
.
" For pre-processing books
command! Book %s/\v([Tt])heyre/\1hey're/gec | %s/\v([Ww])ont/\1on't/gec | %s/\v([Yy])oud/\1ou'd/gec | %s/\v([Nn])eednt/\1eedn't/gec | %s/\v([Ss])houldnt/\1houldn't/gec | %s/\v([Hh])asnt/\1asn't/gec | %s/\v([Cc])ant/\1an't/gec | %s/\v([Tt])hats/\1hat's/gec | %s/\v([Yy])oull/\1ou'll/gec | %s/\v([Yy])oure/\1ou're/gec | %s/\v([Yy])ouve/\1ou've/gec | %s/\v([Ii])ts/\1t's/gec | %s/\v([Dd])ont/\1on't/gec | %s/\v([Aa])rent/\1ren't/gec | %s/\v([Dd])oesnt/\1oesn't/gec | %s/\v([Dd])idnt/\1idn't/gec | %s/\v([Ii])snt/\1sn't/gec | %s/\v([Hh])eres/\1ere's/gec | %s/IDEs\C/IDE's/gec | %s/\v([Nn])onfinal/\1on-final/gec | /\v\c^(chapter|item)|\[.+\]
" Write buffer and delete it afterwards
command! Wd write|bdelete
" Format current buffer that should be an XML document
"command! FormatXml %!xmllint --format -
" Format current selection that should be an XML document
command! -range FormatXml <line1>,<line2>!xmllint --format -
" Copy current buffer contents to the system clipboard (insertion with CTRL+v). Range can be used.
command! -range CopyToClipboard <line1>,<line2>w !xclip -selection clipboard
" Copy current buffer contents to the primary clipboard (insertion with mouse wheel click or with CTRL+SHIFT+INSERT). Range can be used.
command! -range CopyToPrimary <line1>,<line2>w !xclip
" Copy visual selection to the clipboard and pass it to 'eval'
command! -range Eval <line1>,<line2>w !xclip && eval "$(xclip -o)"
" Comment/uncomment shell script
command! -range CommentShellScript <line1>,<line2>s/^/#/g
command! -range UncommentShellScript <line1>,<line2>s/\v^\s*#(.*)/\1/g
" Creates a buffer containing the output of ':browse oldfiles' command at the top
" Move cursor to the path and press ENTER
" TODO: Doesn't open files with spaces in their paths
command! Browse new +setl\ buftype=nofile | 0put =v:oldfiles | nnoremap <buffer> <CR> :e <C-r>=getline('.')<CR><CR>
" If the current line contains a file path, the file will be opened in default program
command! OpenInDefaultProgram exec(":!xdg-open '".getline(".")."'")
" If the current line contains a URL, the URL will be opened in firefox
command! OpenUrlInFirefox exec(":!firefox '".getline(".")."'")
" Remove duplicate method calls. You just want to see which methods have been called and not interested in their call order
command! BtraceUniqMethodCalls %s/\v\(.*\)//g | %sort u | !%uniq
" Remove duplicate classes. You just want to see which classes have been used during execution
command! BtraceUniqClasses %s/\v\.[^\.]{-}\(.*\)//ge | execute 'g/\v\$[0-9]+$/de' | %sort u | %!uniq
" Remove duplicate adjacent method calls. Methods call order is kept.
"command! BtraceRemoveAdjacentDuplicateMethods %s/\v\(.*\)//ge | %!uniq (no
"line numbers)
command! BtraceRemoveAdjacentDuplicateMethods %!awk 'BEGIN {method=""} match($0,/.*\(/) { if (length(method)) { if (index($0,method) == 0) { print $0 } } else { print $0 } method =substr($0, RSTART, RLENGTH-1) }'
set ignorecase
set smartcase
set hidden
set tabstop=2 "2 spaces will be inserted when pressing TAB in INSERT mode
"set softtabstop=0 noexpandtab
set shiftwidth=2 "2 spaces will be inserted when indenting
"set wildmode=longest,list
set history=200
"highlight normal ctermfg=white ctermbg=yellow
set nocompatible
filetype plugin on
filetype indent on
" 'matchit' plugin
"set nocompatible
"filetype plugin on
runtime macros/matchit.vim
" Disable arrow keys in NORMAL mode
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>
:map <F8> <C-E>:sleep 3500m<CR>j<F8>
function! GotoJump()
jumps
let j = input("Please select your jump: ")
if j != ''
let pattern = '\v\c^\+'
if j =~ pattern
let j = substitute(j, pattern, '', 'g')
execute "normal " . j . "\<c-i>"
else
execute "normal " . j . "\<c-o>"
endif
endif
endfunction
"if $TERM_PROGRAM =~ "iTerm" works also for KDE "Konsole"
" let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in insert mode
" let &t_EI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in normal mode
" let &t_SI = "\<Esc>]50;CursorShape=0\x7" " Block in insert mode
" let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Block in normal mode
"endif
set nohlsearch
답변1
Windows에 이미 로컬 설정( )이 있는 것 같습니다 setlocal hlsearch
. 전역 변경은 hlsearch
여기에 영향을 미치지 않으며 세션을 다시 생성하면 이러한 설정만 다시 저장됩니다.
아마도 가장 간단한 해결책은 세션 파일을 열고(세션을 로드하지 않고 텍스트 파일로) 간단히 hlsearch를 설정하는 줄을 제거하는 것입니다.