Skip to content

Instantly share code, notes, and snippets.

@infinitekh
Last active January 18, 2024 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infinitekh/a8fa8a092d0916d2419efb0d1eb4b7fb to your computer and use it in GitHub Desktop.
Save infinitekh/a8fa8a092d0916d2419efb0d1eb4b7fb to your computer and use it in GitHub Desktop.
my vimrc
call plug#begin('~/.vim/plugged')
" 설치
Plug 'Shougo/ddc.vim'
Plug 'vim-denops/denops.vim'
" Install your sources
Plug 'Shougo/ddc-around'
" Install your filters
Plug 'Shougo/ddc-matcher_head'
Plug 'Shougo/ddc-sorter_rank'
" List ends here. Plugins become visible to Vim after this call.
"
"
Plug 'Shougo/ddx.vim'
" qmll vim
Plug 'peterhoeg/vim-qml'
if has('nvim')
"Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
"Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
"telescope
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.5' }
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
"let g:deoplete#enable_at_startup = 1
Plug 'Shougo/neosnippet.vim'
Plug 'Shougo/neosnippet-snippets'
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
"imap <expr><TAB>
" \ pumvisible() ? "\<C-n>" :
" \ neosnippet#expandable_or_jumpable() ?
" \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
"\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" For conceal markers.
"if has('conceal')
"set conceallevel=2 concealcursor=niv
"endif
" Multiple Plug commands can be written in a single line using | separators
Plug 'jpalardy/vim-slime' " vim send message to terminal
"  Send message ( full or visual )
" v Config Slime ( seesion name -> screen -S "name" )
"
Plug 'preservim/nerdtree' " nerdtree
Plug 'vim-syntastic/syntastic' " syntastic
Plug 'wellle/targets.vim'
"color scheme
Plug 'tomasr/molokai'
Plug 'flazz/vim-colorschemes'
Plug 'itchyny/lightline.vim'
" Plugin auto completion
" C
Plug 'ronakg/quickr-cscope.vim'
Plug 'majutsushi/tagbar'
" git
Plug 'tpope/vim-fugitive' " git log airline
Plug 'airblade/vim-gitgutter' " view code change
" arduino
Plug 'stevearc/vim-arduino'
" Change these as desired
nnoremap <buffer> <leader>aa <cmd>ArduinoAttach<CR>
nnoremap <buffer> <leader>av <cmd>ArduinoVerify<CR>
nnoremap <buffer> <leader>au <cmd>ArduinoUpload<CR>
nnoremap <buffer> <leader>aus <cmd>ArduinoUploadAndSerial<CR>
nnoremap <buffer> <leader>as <cmd>ArduinoSerial<CR>
nnoremap <buffer> <leader>ab <cmd>ArduinoChooseBoard<CR>
nnoremap <buffer> <leader>ap <cmd>ArduinoChooseProgrammer<CR>
let g:arduino_serial_baud = 115200
Plug 'ujihisa/unite-colorscheme'
Plug 'unblevable/quick-scope'
" f 명령 하이라이트 빠른 커서전환
" You can specify revision/branch/tag.
Plug 'kalafut/vim-taskjuggler'
" ruby 사용
"
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" vim fzf settings
"k Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Insert mode completion
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-l> <plug>(fzf-complete-line)
" This is the default option:
" - Preview window on the right with 50% width
" - CTRL-/ will toggle preview window.
" - Note that this array is passed as arguments to fzf#vim#with_preview function.
" - To learn more about preview window options, see `--preview-window` section of `man fzf`.
let g:fzf_vim = {}
let g:fzf_vim.preview_window = ['right,50%', 'ctrl-/']
" Preview window is hidden by default. You can toggle it with ctrl-/.
" It will show on the right with 50% width, but if the width is smaller
" than 70 columns, it will show above the candidate list
let g:fzf_vim.preview_window = ['hidden,right,50%,<70(up,40%)', 'ctrl-/']
" Empty value to disable preview window altogether
let g:fzf_vim.preview_window = []
" fzf.vim needs bash to display the preview window.
" On Windows, fzf.vim will first see if bash is in $PATH, then if
" Git bash (C:\Program Files\Git\bin\bash.exe) is available.
" If you want it to use a different bash, set this variable.
" let g:fzf_vim.preview_bash = 'C:\Git\bin\bash.exe'
" [Buffers] Jump to the existing window if possible
let g:fzf_vim.buffers_jump = 1
" [[B]Commits] Customize the options used by 'git log':
let g:fzf_vim.commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
" [Tags] Command to generate tags file
let g:fzf_vim.tags_command = 'ctags -R'
" [Commands] --expect expression for directly executing the command
let g:fzf_vim.commands_expect = 'alt-enter,ctrl-x'
" Default: Use quickfix list
let g:fzf_vim.listproc = { list -> fzf#vim#listproc#quickfix(list) }
" Use location list instead of quickfix list
let g:fzf_vim.listproc = { list -> fzf#vim#listproc#location(list) }
" vala
Plug 'vala-lang/vala.vim'
" cmake completion
Plug 'richq/vim-cmake-completion'
" vim dirdiff
Plug 'will133/vim-dirdiff'
Plug 'honza/vim-snippets'
Plug 'tpope/vim-surround'
Plug 'infinitekh/HOMM3_ERM.vim'
Plug 'ctrlpvim/ctrlp.vim' " file search
""Plug 'https://bitbucket.org/kovisoft/slimv'
" User add package
"Plug 'gabrielelana/vim-markdown'
Plug 'shime/vim-livedown'
"Plug 'jaxbot/browserlink.vim'
" pretty status bar
Plug 'vim-airline/vim-airline'
"python tool
Plug 'davidhalter/jedi-vim'
Plug 'tell-k/vim-autopep8'
"IM control
autocmd FileType python set omnifunc=python3complete#Complete
" syntastic python
let g:syntastic_python_checkers = [ 'pep8' ]
"let g:syntastic_python_checkers = [ 'flake8' ]
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
"syntastic c
syntax on
"latex
"
Plug 'lervag/vimtex'
let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
let g:vimtex_quickfix_mode=0
set conceallevel=1
let g:tex_conceal='abdmg'
" HTML CSS Javascript
Plug 'mattn/emmet-vim'
" pretty view
Plug 'junegunn/vim-easy-align'
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
Plug 'godlygeek/tabular'
" Gtrans
Plug 'haya14busa/vim-gtrans'
Plug 'WolfgangMehner/vim-plugins'
" GLSL
Plug 'tikhomirov/vim-glsl'
" 벽돌깨기
Plug 'johngrib/vim-game-code-break'
"call plug#end()
"call plug#begin('~/.vim/plugged_uniict')
Plug 'jkramer/vim-checkbox'
" vim startify -- vim wiki
Plug 'mhinz/vim-startify'
Plug 'vimwiki/vimwiki' , { 'branch': 'dev' }
call plug#end()
"call plug#end()
" 설정
" https://github.com/Shougo/ddc-around
call ddc#custom#patch_global('sources', ['around'])
call ddc#custom#patch_global('sourceOptions', #{ around: #{ mark: 'A' }, })
call ddc#custom#patch_global('sourceParams', #{ around: #{ maxSize: 500 }, })
" Mappings
" <TAB>: completion.
" <S-TAB>: completion back.
" Use ddc.
call ddc#enable()
filetype plugin indent on " required!
filetype indent on
syntax on
scripte utf-8
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
"End PlugScripts-------------------------
set nocompatible " Vim 디폴트 기능들을 사용함
set backspace=2 " 삽입 모드에서 백스페이스를 계속 허용
set autoindent " 자동 들여쓰기
set cindent " c언어 자동 들여쓰기
set smartindent " 자동 들여쓰기
"set textwidth=76 " 76번째 칸을 넘어가면 자동으로 줄 바꿈
set nowrapscan " 찾기에서 파일의 맨 끝에 이르면 계속하여 찾지 않음
"set nobackup " 백업파일을 만들지 않음
"set novisualbell " 비주얼벨 기능을 사용하지 않음
set nojoinspaces " J 명령어로 줄을 붙일 때 마침표 뒤에 한칸만 띔
set ruler " 상태 표시줄에 커서 위치를 표시
set tabstop=2 " 탭간격
set shiftwidth=2 " 자동 들여쓰기 간격
set showcmd " (부분적인) 명령어를 상태라인에 보여줌
set showmatch " 매치도는 괄호의 반대쪽을 보여줌
"set ignorecase " 찾기에서 대/소문자를 구별하지 않음
set incsearch " 점진적으로 찾기
set autowrite " :next나 :make같은 명령을 입력하면 자동으로 저장
set title " 타이틀바에 현재 편집중인 파일을 표시
set nu " 라인번호
syntax on " 문법 강조기능
set fenc=utf-8
set fencs=utf-8,cp949,cp932,euc-jp,shift-jis,big5,latin1,ucs-2le
map <F10> :sp tags<CR>:%s/^\([^ :]*:\)\=\([^ ]*\).*/syntax keyword Tag \2/<CR>:wq! tags.vim<CR>/^<CR><F12>
map <F12> :so tags.vim<CR>
"=============================================
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
if filereadable("./cscope.out")
cs add cscope.out
"else
" cs add /usr/src/linux/cscope.out
endif
set csverb
"==============================================
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
set viminfo='10,\"100,:20,%,n~/.viminfo
augroup resCur
autocmd!
if has("folding")
autocmd BufWinEnter * if ResCur() | call UnfoldCur() | endif
else
autocmd BufWinEnter * call ResCur()
endif
augroup END
if has("folding")
function! UnfoldCur()
if !&foldenable
return
endif
let cl = line(".")
if cl <= 1
return
endif
let cf = foldlevel(cl)
let uf = foldlevel(cl - 1)
let min = (cf > uf ? uf : cf)
if min
execute "normal!" min . "zo"
return 1
endif
endfunction
endif
let g:html_indent_inctags = "html,body,head,tbody"
let g:syntastic_cpp_compiler = 'g++'
let g:syntastic_cpp_compiler_options = " -Wall "
"let g:syntastic_cpp_no_include_search = 1
"let g:syntastic_cpp_no_default_include_dirs = 1
let g:syntastic_cpp_auto_refresh_includes = 1
let g:syntastic_c_checkers = ['gcc', 'make']
let g:syntastic_c_compiler = 'gcc'
let g:syntastic_c_config_file = '.config_c'
let g:syntastic_c_no_default_include_dirs = 0
"let g:syntastic_c_no_include_search = 1
"let g:syntastic_c_check_header = 1
"let g:syntastic_c_include_dirs = [ 'includes', 'headers', '/usr/include/gtk-3.0/' ]
let g:syntastic_c_compiler_options = '-Wall'
let g:syntastic_tex_checkers = ['lacheck', 'text/language_check']
colorscheme shine
let mysyntaxfile = "~/.vim/mysyntax.vim"
syntax on
function Rand()
return str2nr(matchstr(reltimestr(reltime()), '\v\.@<=\d+')[1:])
endfunction
" c-support UseTool_cmake and doxygen
let g:C_UseTool_cmake = 'yes'
let g:C_UseTool_doxygen = 'yes'
"call mmtemplates#config#Add ( 'C', '/home/kh/.vim/plugged/c-support/c-support/templates/, 'Doxygen', 'ntd' )
" Automatically save the current session whenever vim is closed
"autocmd VimLeave * mksession! ~/.vim/shutdown_session.vim
"
"" <F7> restores that 'shutdown session'
"noremap <F7> :source ~/.vim/shutdown_session.vim<CR>
"
"" If you really want to, this next line should restore the shutdown session
"" automatically, whenever you start vim. (Commented out for now, in case
"" somebody just copy/pastes this whole block)
""
"autocmd VimEnter source ~/.vim/shutdown_session.vim<CR>
" manually save a session with <F5>
noremap <F5> :mksession! ~/.vim/manual_session.vim<cr>
" recall the manually saved session with <F6>
noremap <F6> :source ~/.vim/manual_session.vim<cr>
"-------------------------------------------------------------------------------
" My setup
"-------------------------------------------------------------------------------
inoremap \fn <C-R>=expand("%:t:r")<CR>
cnoremap <C-W> <C-R>=expand("<cword>")<CR>
"Neosnippet
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
imap <expr><TAB>
\ pumvisible() ? "\<C-n>" :
\ neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
let g:neosnippet#snippets_directory="/home/kh/.vim/MyNeoSnippets"
"" For conceal markers.
"if has('conceal')
"set conceallevel=2 concealcursor=niv
"endif
" NERD-tree toggle
map <C-o> :NERDTreeToggle<CR>
" 파일없이 vim만 틸 경우 자동으로 NERD Tree 실행.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" 디렉토리를 vim으로 여는 경우 NERD Tree 실행.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
" Recommended key-mappings.
"
" 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
" KH --------
colorscheme desert
inoremap \fn <C-R>=expand("%:t")<CR>
vnoremap \fn <C-R>=expand("%:t")<CR>
"put=expand('%:t')
" live down preview
" should markdown preview get shown automatically upon opening markdown buffer
let g:livedown_autorun = 0
" should the browser window pop-up upon previewing
let g:livedown_open = 1
" the port on which Livedown server will run
let g:livedown_port = 4343
" the browser to use
let g:livedown_browser = "/usr/bin/google-chrome"
" move window to tab
function MoveToPrevTab()
"there is only one window
if tabpagenr('$') == 1 && winnr('$') == 1
return
if tabpagenr('$') == 1 && winnr('$') == 1
return
endif
"preparing new window
let l:tab_nr = tabpagenr('$')
let l:cur_buf = bufnr('%')
if tabpagenr() != 1
close!
if l:tab_nr == tabpagenr('$')
tabprev
endif
sp
else
close!
exe "0tabnew"
endif
"opening current buffer in new window
exe "b".l:cur_buf
endfunc
function MoveToNextTab()
"there is only one window
if tabpagenr('$') == 1 && winnr('$') == 1
return
endif
"preparing new window
let l:tab_nr = tabpagenr('$')
let l:cur_buf = bufnr('%')
if tabpagenr() < tab_nr
close!
if l:tab_nr == tabpagenr('$')
tabnext
endif
sp
else
close!
tabnew
endif
"opening current buffer in new window
exe "b".l:cur_buf
endfunc
nnoremap <A-.> :call MoveToNextTab()<CR>
nnoremap <A-,> :call MoveToPrevTab()<CR>
let g:livepreview_previewer = 'okular'
let g:Latex_PdfViewer ="okular"
let g:slime_target = "screen"
let g:slime_paste_file = tempname()
let g:slime_python_ipython =1
"abbr
iabbr __email ekh0324@gmail.com
iabbr <expr> __time strftime("%Y-%m-%d %H:%M:%S")
iabbr <expr> __file expand('%:p')
iabbr <expr> __name expand('%')
iabbr <expr> __pwd expand('%:p:h')
iabbr <expr> __branch system("git rev-parse --abbrev-ref HEAD")
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" cscope
function! LoadCscope()
let db = findfile("cscope.out", ".;")
if (!empty(db))
let path = strpart(db, 0, match(db, "/cscope.out$"))
set nocscopeverbose " suppress 'duplicate connection' error
exe "cs add " . db . " " . path
set cscopeverbose
" else add the database pointed to by environment variable
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
endfunction
au BufEnter /* call LoadCscope()
let g:Templates_UsePersonalizationFile = 'yes'
let mapleader = '\'
let maplocalleader = '\'
set nocompatible
if has('python') " if dynamic py|py3, this line already activates python2.
let s:python_version = 2
elseif has('python3')
let s:python_version = 3
else
let s:python_version = 0
endif
echomsg 'Using python'.s:python_version
packadd lsp
" Clangd language server
call LspAddServer([#{
\ name: 'clangd',
\ filetype: ['c', 'cpp'],
\ path: '/usr/bin/clangd',
\ args: ['--background-index']
\ }])
" Javascript/Typescript language server
call LspAddServer([#{
\ name: 'typescriptlang',
\ filetype: ['javascript', 'typescript'],
\ path: '/usr/local/bin/typescript-language-server',
\ args: ['--stdio'],
\ }])
" CMakeLanguageServer
call LspAddServer([#{
\ name: 'cmake',
\ filetype: ['cmake' ],
\ path: '/usr/local/bin/cmake-language-server',
\ }])
" arduino
call LspAddServer([#{
\ name: 'arduino',
\ filetype: ['arduino' ],
\ path: '/root/git/arduino-language-server',
\ }])
nnoremap ]l <Cmd>LspDiagNext<CR>
nnoremap [l <Cmd>LspDiagPrev<CR>
augroup custom_keywordprg
autocmd!
autocmd FileType c,cpp setlocal keywordprg=:LspHover
autocmd FileType python setlocal keywordprg=:Pydoc
augroup end
set ts=4 sw=4
set path+=**
set wildmenu
packadd vim-ledger
"## noimd 명령모드에서 한글입력 등 끄기.
set noimd
"1번 위키(공개용)와 2번 위키(개인용)
let g:vimwiki_list = [
\{
\ 'path': '/root/git/infinitekh.github.io/_wiki',
\ 'ext' : '.md',
\ 'diary_rel_path': '../diary',
\},
\{
\ 'path': '~/wiki',
\ 'ext' : '.md',
\ 'diary_rel_path': '.',
\},
\]
" vimwiki의 conceallevel 을 끄는 쪽이 좋다
let g:vimwiki_conceallevel = 0
" 자주 사용하는 vimwiki 명령어에 단축키를 취향대로 매핑해둔다
command! WikiIndex :VimwikiIndex
nmap <LocalLeader>ww <Plug>VimwikiIndex
nmap <LocalLeader>wi <Plug>VimwikiDiaryIndex
nmap <LocalLeader>w<LocalLeader>w <Plug>VimwikiMakeDiaryNote
nmap <LocalLeader>wt :VimwikiTable<CR>
" F4 키를 누르면 커서가 놓인 단어를 위키에서 검색한다.
nnoremap <F4> :execute "VWS /" . expand("<cword>") . "/" <Bar> :lopen<CR>
" Shift F4 키를 누르면 현재 문서를 링크한 모든 문서를 검색한다
nnoremap <S-F4> :execute "VWB" <Bar> :lopen<CR>
au BufNewFile,BufRead *.v set filetype=verilog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment