Skip to content

Instantly share code, notes, and snippets.

@sideseal
Last active February 21, 2025 01:19
Show Gist options
  • Select an option

  • Save sideseal/f5eecc820c7d9031bb2e92f032f46af6 to your computer and use it in GitHub Desktop.

Select an option

Save sideseal/f5eecc820c7d9031bb2e92f032f46af6 to your computer and use it in GitHub Desktop.
my new vimrc
set nocompatible
set diffopt+=iwhite
set nobackup
set noswapfile
set fileencodings=utf-8,euc-kr
set history=1000
set mouse+=a
set nu
set ai
set si
set ci
set expandtab
set ts=4 sts=4 sw=4
set fileencodings=utf-8,euc-kr
set ignorecase
set smartcase
set ve+=onemore
set hlsearch
set ruler
set title
set showmatch
set nowrap
set linebreak
set showbreak=↳
set breakindent
hi NonText ctermfg=Gray guifg=Gray
hi SpecialKey ctermfg=Gray guifg=Gray
set wmnu
set ls=2
syntax on
set cc=80
colorscheme ron
set clipboard=unnamedplus
" set paste
let mapleader = "g"
noremap <leader>1 1gt
noremap <leader>2 2gt
noremap <leader>3 3gt
noremap <leader>4 4gt
noremap <leader>5 5gt
noremap <leader>6 6gt
noremap <leader>7 7gt
noremap <leader>8 8gt
noremap <leader>9 9gt
noremap <leader>0 :tablast<CR>
" --------- netwr setting moves like NERDTree!
let g:netrw_sort_sequence = '[\/]$,*'
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 3
let g:netrw_altv = 1
let g:netrw_winsize = 25
let g:netrw_fastbrowse = 0
nnoremap <silent> <TAB><TAB> :Vexplore %:p:h<CR>
autocmd FileType netrw nnoremap <buffer> <silent> <TAB><TAB> :bd<CR>
autocmd FileType netrw setl bufhidden=wipe
function! CloseNetrw() abort
for bufn in range(1, bufnr('$'))
if bufexists(bufn) && getbufvar(bufn, '&filetype') ==# 'netrw'
silent! execute 'bwipeout ' . bufn
if getline(2) =~# '^" Netrw '
silent! bwipeout
endif
return
endif
endfor
endfunction
augroup closeOnOpen
autocmd!
autocmd BufWinEnter * if getbufvar(winbufnr(winnr()), "&filetype") != "netrw"|call CloseNetrw()|endif
aug END
" --------------------------------------------
" --------- persistent undo
if has('persistent_undo')
let s:vimDir = '$HOME/.vim'
let &runtimepath.=','.s:vimDir
let s:undoDir = expand(s:vimDir . '/undodir')
call system('mkdir ' . s:vimDir)
call system('mkdir ' . s:undoDir)
let &undodir = s:undoDir
set undofile
endif
set undolevels=1000
let g:markdown_fenced_languages = ['html', 'python', 'vim', 'c', 'js=javascript', 'sh=bash', 'zsh', 'css']
hi link markdownItalic Normal
hi link markdownError Normal
set maxmempattern=5000
" autocmd BufWritePre ~/.vimrc :1,10s/^\" Last Modified: \zs.*$/\=strftime('%Y-%m-%d %H:%M:%S')/
" --------------------------------------------
" --------- autoread
set autoread
set updatetime=1000
augroup autoread_check
autocmd!
autocmd FocusGained,BufEnter * checktime
autocmd CursorHold,CursorHoldI * checktime
augroup END
" --------------------------------------------
" --------- ctags & cscope
" ----- make_tags.sh
" #!/bin/bash
"
" CTAGS_FILE="tags"
" CSCOPE_OUT="cscope.out"
" VIMRC_FILE="$HOME/.vimrc"
"
" CURRENT_DIR=$(pwd)
"
" echo "Creating ctags file ..."
" ctags -R .
"
" echo "Creating cscope file ..."
" cscope -Rbq
"
" if grep -q "set tags+=" "$VIMRC_FILE"; then
" echo "Updating ctags path ..."
" sed -i "s|^set tags+=.*|set tags+=$CURRENT_DIR/$CTAGS_FILE|" "$VIMRC_FILE"
" fi
"
" if grep -q "cs add" "$VIMRC_FILE"; then
" echo "Updating cscope path ..."
" sed -i "s|^[[:space:]]*cs add .*|cs add $CURRENT_DIR/$CSCOPE_OUT|" "$VIMRC_FILE"
" fi
"
" echo "END"
set tags+=/home/odroid/gst_agmplayer/tags
if has("cscope")
cs add /home/odroid/gst_agmplayer/cscope.out
set cscopetag cscopeverbose
set cscopequickfix=s+,c+,d+,i+,t+,e+
endif
set csprg=/usr/bin/cscope
set nocsverb
set csverb
set csto=0
set csre
set cst
" --------------------------------------------
" --------- cscope command
"Find this C Symbol
func! Css()
let css = expand("<cword>")
" new
exe "cs find s ".css
if getline(1) == ""
exe "q!"
endif
endfunc
nmap ,css :call Css() <cr>
"Find functions calling this function
func! Csc()
let csc = expand("<cword>")
" new
exe "cs find c ".csc
if getline(1) == ""
exe "q!"
endif
endfunc
nmap ,csc :call Csc() <cr>
"Find functions called by this function
func! Csd()
let csd = expand("<cword>")
" new
exe "cs find d ".csd
if getline(1) == ""
exe "q!"
endif
endfunc
nmap ,csd :call Csd() <cr>
"Find this definition
func! Csg()
let csg = expand("<cword>")
" new
exe "cs find g ".csg
if getline(1) == ""
exe "q!"
endif
endfunc
nmap ,csg :call Csg() <cr>
" --------------------------------------------
" --------- save with sudo
ca w!! w !sudo tee "%"
" --------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment