Skip to content

Instantly share code, notes, and snippets.

@sunasaji
Last active November 27, 2022 07:49
Show Gist options
  • Save sunasaji/e4611fb7ddc6d6d02c39020d1c0e96a0 to your computer and use it in GitHub Desktop.
Save sunasaji/e4611fb7ddc6d6d02c39020d1c0e96a0 to your computer and use it in GitHub Desktop.
set runtimepath^=~/.vim/
set runtimepath^=~/.vim/after
set directory=~/.vim/swp
set backupdir=~/.vim/backup
set undodir=~/.vim/undo
filetype plugin indent on
syntax enable
colorscheme koehler
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,sjis,cp932,euc-jp,iso-2022-jp,utf-16le,default,latin1
set ambiwidth=double
set fileformats=unix,dos,mac
scriptencoding utf-8
set statusline=%<%F%h%m%r[%{&fileencoding!=''?&fileencoding:&encoding}][%{&ff}]%y(%{strftime(\"%Y/%m/%d\ %H:%M\",getftime(expand(\"%:p\")))})\ L%l/%L,C%c\ %V\ %P
set laststatus=2
set nocompatible
set title
set showmode
set hidden
set autoread
set wildmenu
set ignorecase
set smartcase
set hlsearch
set splitbelow
set splitright
"set list
set cursorline
set incsearch
set wildmode=list:longest
set shortmess=aoOtIF
set grepprg=grep\ --binary-file=text\ -arniH\ --exclude-dir=.git
autocmd QuickfixCmdPost vimgrep copen
autocmd QuickfixCmdPost grep copen
let g:netrw_liststyle=3
let g:netrw_banner=1
let g:netrw_sizestyle="H"
let g:netrw_timefmt="%Y/%m/%d(%a) %H:%M:%S"
"let g:netrw_preview=1
let g:netrw_browse_split=4
"let g:netrw_winsize=20
let g:netrw_alto=1
let g:netrw_altv=0
let g:EasyGrepOpenWindowOnMatch=0
augroup VimStartup
au!
au VimEnter * if expand("%") == "" | ex . | endif
augroup END
autocmd QuickFixCmdPost * nested cwindow 20 | redraw!
command! -nargs=1 Grep execute 'set hlsearch | call MyGrep(<q-args>)'
noremap <leader>g :Grep<space>
function MyGrep(arg)
"execute 'silent grep --binary-file=text -anriH' a:arg a:dir
cgetexpr system(printf('%s "%s" .',&grepprg, a:arg)) | cw
execute "let @/ = a:arg"
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment