Skip to content

Instantly share code, notes, and snippets.

@shepherd44
Last active December 9, 2021 23:18
Show Gist options
  • Save shepherd44/55d945386705d22e8c3c3a9bd70d6d45 to your computer and use it in GitHub Desktop.
Save shepherd44/55d945386705d22e8c3c3a9bd70d6d45 to your computer and use it in GitHub Desktop.
vim setting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim default setting
set ts=2 sw=2
autocmd FileType python set ts=2 sw=2 et
autocmd FileType ruby set ts=2 sw=2 et
autocmd FileType vim set ts=2 sw=2 et
autocmd FileType json set ts=2 sw=2 et
autocmd FileType yaml set ts=2 sw=2 et
autocmd FileType sql set ts=2 sw=2 et
autocmd FileType markdown set ts=2 sw=2 et
autocmd FileType cpp set ts=4 sw=4
autocmd FileType c set ts=4 sw=4
autocmd FileType make set ts=4 sw=4
set wrap
set novb
set hlsearch
set backspace=indent,eol,start
set wmnu
set fencs=utf-8,cp949,cp932,euc-jp,shift-jis,big5,ucs-2le,latin1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" indent setting
set autoindent
set smartindent
set cindent
set cino+=g0
set cino+=:0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ctag file set
set tags+=./tags
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" cscope 媛꾨떒 �뗮똿
" set csprg=/usr/bin/cscope
" set csto=0(�レ옄 0)
" set cst
" set nocsverb
" if filereadable("./cscope.out")
" cs add cscope.out
" else
" cs add /usr/src/linux/cscope.out
" endif
" set csverb
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" bundle setting
" set the runtime path to include Vundle and initialize
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'https://github.com/Shougo/neocomplete.vim'
"Plugin 'https://github.com/kien/ctrlp.vim'
"Plugin 'vim-scripts/Conque-GDB'
"Plugin 'Valloric/YouCompleteMe'
Plugin 'https://github.com/sjl/splice.vim'
" git plugin
Plugin 'airblade/vim-gitgutter'
" indent guide plugin
Plugin 'nathanaelkane/vim-indent-guides'
" vim-airline
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" vim theme plugin
Plugin 'jpo/vim-railscasts-theme'
Plugin 'nanotech/jellybeans.vim'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" color theme setting
syn on
set t_Co=256
" colo ron
" colo railscasts
colo jellybeans
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ctrlp
"let g:ctrlp_map = '<c-p>'
"let g:ctrlp_cmd = 'CtrlP'
"let g:ctrlp_working_path_mode = 'ra'
"set wildignore+=*/tmp/*,*.so,*.swp,*.zip
"let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
"let g:ctrlp_custom_ignore = {
" \ 'dir': '\v[\/]\.(git|hg|svn)$',
" \ 'file': '\v\.(exe|so|dll)$',
" \ 'link': 'some_bad_symbolic_links',
" \ }
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-airline setting
let g:airline#extensions#tabline#enabled = 1 " turn on buffer list
let g:airline_theme='luna'
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim-indent-guides setting
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_auto_colors = 0
"autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=darkgray
"autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=darkgray
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" neocomplete
"Note: This option must be set in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 4
" Define dictionary.
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" Define keyword.
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
" For no inserting <CR> key.
"return pumvisible() ? "\<C-y>" : "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
" Close popup by <Space>.
"inoremap <expr><Space> pumvisible() ? "\<C-y>" : "\<Space>"
" AutoComplPop like behavior.
"let g:neocomplete#enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplete#enable_auto_select = 1
"let g:neocomplete#disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
"let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
"let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" conque-gdb
"let g:ConqueTerm_Color = 2 " 1: strip color after 200 lines, 2: always with color
"let g:ConqueTerm_CloseOnEnd = 1 " close conque when program ends running
"let g:ConqueTerm_StartMessages = 0 " display warning messages if conqueTerm is configured incorrectly
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" map setting
map <F1> :!ctags -R ./ <CR><CR> :!mkcscope.sh <CR><CR>
map <F2> :w <CR>
map <F3> v]}zf " fold
map <F4> zo " close fold
map <F5> :make <CR> :copen<CR><CR> " compile and copen build result output window
map <F6> :cn<CR> " next error
map <F7> :cp<CR> " prev error
map <F8> :cclose<CR> " close build result output window
map <F9> [i "
map <F10> '' " go definition (?)
map <F11> ^] " go tag
map <F12> ^T " back tag
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim jump other screen with ctrl + [hjkl]
"nmap <c-h> <c-w>h
"nmap <c-j> <c-w>j
"nmap <c-k> <c-w>k
"nmap <c-l> <c-w>l
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 二쇱꽍
"func! CmtOn()
" exe "'<,'>norm i//"
"endfunc
"func! CmtOff()
" exe "'<,'>norm 2x"
"endfunc
"vmap <c-x> <esc>:call CmtOn() <cr>
"vmap <c-z> <esc>:call CmtOff() <cr>
"nmap <c-x> <esc>v:call CmtOn() <cr>
"nmap <c-z> <esc>v:call CmtOff() <cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
#!/bin/sh
rm -rf cscope.files cscope.files
find ./ \( -name '*.c' -o -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.s' -o -name '*.S' -o -name '*.hpp' -o -name '*.ipp' \) -print > cscope.files
cscope -b -i cscope.files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment