public:computer:vim_cheat_sheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
public:computer:vim_cheat_sheet [2022/03/21 17:20] – [_gvimrc] alexpublic:computer:vim_cheat_sheet [2023/01/01 01:06] (current) – [Examples] alex
Line 439: Line 439:
 |:args |현재 열린 모든 파일중 현재 편집중인 파일 표시 | |:args |현재 열린 모든 파일중 현재 편집중인 파일 표시 |
  
-==== _gvimrc ====+==== _vimrc ==== 
 +  * Install Vundle<sxh bash> 
 +$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 
 +or 
 +> cd %USERPROFILE% 
 +> git clone https://github.com/VundleVim/Vundle.vim.git %USERPROFILE%/.vim/bundle/Vundle.vim 
 +> gvim .vimrc 
 +</sxh> 
 + 
 +  * Plugin 
 +<sxh shell title:_vimrc> 
 +set nocompatible              " be iMproved, required 
 +filetype off                  " required 
 +set shellslash 
 + 
 +"-------------------------------------------------------------- 
 +" Specify a directory for plugins 
 +" - For Neovim: stdpath('data') . '/plugged' 
 +" - Avoid using standard Vim directory names like 'plugin' 
 +"call plug#begin('~/.vim/plugged'
 + 
 +" Make sure you use single quotes 
 + 
 +" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align 
 +"Plug 'junegunn/vim-easy-align' 
 + 
 +" Any valid git URL is allowed 
 +"Plug 'https://github.com/junegunn/vim-github-dashboard.git' 
 + 
 +" Multiple Plug commands can be written in a single line using | separators 
 +"Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' 
 + 
 +" On-demand loading 
 +"Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle'
 +"Plug 'tpope/vim-fireplace', { 'for': 'clojure'
 + 
 +" Using a non-default branch 
 +"Plug 'rdnetto/YCM-Generator', { 'branch': 'stable'
 + 
 +" Using a tagged release; wildcard allowed (requires git 1.9.2 or above) 
 +"Plug 'fatih/vim-go', { 'tag': '*'
 + 
 +" Plugin options 
 +"Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim'
 + 
 +" Plugin outside ~/.vim/plugged with post-update hook 
 +"Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } 
 + 
 +" Unmanaged plugin (manually installed and updated) 
 +"Plug '~/my-prototype-plugin' 
 + 
 +" Plugin airline 
 +"Plug 'vim-airline/vim-airline' 
 +"Plug 'vim-airline/vim-airline-themes' 
 + 
 +"Plug 'scrooloose/syntastic' 
 +"Plug 'posva/vim-vue' 
 +"Plug 'altercation/vim-colors-solarized' 
 + 
 +" Initialize plugin system 
 +"call plug#end() 
 +"-------------------------------------------------------------- 
 +" set the runtime path to include Vundle and initialize 
 +set rtp+=~/.vim/bundle/Vundle.vim 
 +call vundle#begin() 
 +" alternatively, pass a path where Vundle should install plugins 
 +"call vundle#begin('~/some/path/here'
 + 
 +" let Vundle manage Vundle, required 
 +Plugin 'VundleVim/Vundle.vim' 
 + 
 +" The following are examples of different formats supported. 
 +" Keep Plugin commands between vundle#begin/end. 
 +" plugin on GitHub repo 
 +Plugin 'tpope/vim-fugitive' 
 +" plugin from http://vim-scripts.org/vim/scripts.html 
 +" Plugin 'L9' 
 +" Git plugin not hosted on GitHub 
 +Plugin 'git://git.wincent.com/command-t.git' 
 +" git repos on your local machine (i.e. when working on your own plugin) 
 +"Plugin 'file:///home/gmarik/path/to/plugin' 
 +" The sparkup vim script is in a subdirectory of this repo called vim. 
 +" Pass the path to set the runtimepath properly. 
 +Plugin 'rstacruz/sparkup', {'rtp': 'vim/'
 +" Install L9 and avoid a Naming conflict if you've already installed a 
 +" different version somewhere else. 
 +" Plugin 'ascenator/L9', {'name': 'newL9'
 + 
 +Plugin 'vim-airline/vim-airline' 
 +Plugin 'vim-airline/vim-airline-themes' 
 +Plugin 'scrooloose/syntastic' 
 +Plugin 'posva/vim-vue' 
 +Plugin 'altercation/vim-colors-solarized' 
 + 
 + 
 +" 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 
 +"-------------------------------------------------------------- 
 +" An example for a gvimrc file. 
 +" The commands in this are executed when the GUI is started, after the vimrc 
 +" has been executed. 
 +
 +" Maintainer: Bram Moolenaar <Bram@vim.org> 
 +" Last change: 2016 Apr 05 
 +
 +" To use it, copy it to 
 +        for Unix:  ~/.gvimrc 
 +       for Amiga:  s:.gvimrc 
 +  for MS-Windows:  $VIM\_gvimrc 
 +       for Haiku:  ~/config/settings/vim/gvimrc 
 +     for OpenVMS:  sys$login:.gvimrc 
 + 
 +" Make external commands work through a pipe instead of a pseudo-tty 
 +"set noguipty 
 + 
 +" set the X11 font to use 
 +" set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1 
 + 
 +set ch=2 " Make command line two lines high 
 + 
 +set mousehide " Hide the mouse when typing text 
 + 
 +" Make shift-insert work like in Xterm 
 +map <S-Insert> <MiddleMouse> 
 +map! <S-Insert> <MiddleMouse> 
 + 
 +" Only do this for Vim version 5.0 and later. 
 +if version >= 500 
 + 
 +  " Switch on syntax highlighting if it wasn't on yet. 
 +  if !exists("syntax_on"
 +    syntax on 
 +  endif 
 + 
 +  " For Win32 version, have "K" lookup the keyword in a help file 
 +  "if has("win32"
 +  "  let winhelpfile='windows.hlp' 
 +  "  map K :execute "!start winhlp32 -k <cword> " . winhelpfile <CR> 
 +  "endif 
 + 
 +  " Set nice colors 
 +  " background for normal text is light grey 
 +  " Text below the last line is darker grey 
 +  " Cursor is green, Cyan when ":lmap" mappings are active 
 +  " Constants are not underlined but have a slightly lighter background 
 +  highlight Normal guibg=grey90 
 +  highlight Cursor guibg=Green guifg=NONE 
 +  highlight lCursor guibg=Cyan guifg=NONE 
 +  highlight NonText guibg=grey80 
 +  highlight Constant gui=NONE guibg=grey95 
 +  highlight Special gui=NONE guibg=grey95 
 + 
 +endif 
 + 
 + 
 +set guifont=D2Coding:h12:cHANGEUL:qDEFAULT 
 +" set guifont=Source_Code_Pro:h12:cANSI:qDEFAULT 
 + 
 +if has("gui_running"
 +  set encoding=utf-8   
 + 
 +  source $VIMRUNTIME/mswin.vim 
 +  behave mswin 
 +   
 +  if has('win32'
 +    set keymodel=startsel 
 +        
 +    " set guifont=Source\ Code\ Pro:h16:cANSI:qDEFAULT 
 +    " set guifont=JetBrains\ Mono\ Regular:h18:cANSI:qDEFAULT 
 +    " set guifont=D2Coding\ ligature:h16:cHANGEUL:qDEFAULT      
 +   set renderoptions=type:directx, 
 +       \gamma:1.0, 
 +       \contrast:0.5, 
 +       \level:1, 
 +       \geom:1, 
 +       \renmode:5, 
 +       \taamode:
 + 
 +      " restore Ctrl-F to Page down 
 +    unmap <C-F> 
 +  elseif has('gui_macvim'  
 +    set guifont=JetBrains\ Mono\ 16 
 +    set antialias 
 +  else 
 +    set guifont=JetBrains\ Mono\ 16 
 +  endif 
 + 
 +  " Turn off toolbar 
 +  "set guioptions-=T 
 +  " Turn on menu 
 +  "set guioptions+=m 
 +end 
 + 
 +set smartindent 
 +set tabstop=2 
 +set expandtab 
 +set shiftwidth=2 
 + 
 +" colorscheme darkblue 
 + 
 +"set statusline+=%#warningmsg# 
 +"set statusline+=%{SyntasticStatuslineFlag()} 
 +"set statusline+=%* 
 + 
 +"let g:syntastic_always_populate_loc_list = 1 
 +"let g:syntastic_auto_loc_list = 1 
 +"let g:syntastic_check_on_open = 1 
 +"let g:syntastic_check_on_wq = 0 
 + 
 +let g:airline#extensions#tabline#enabled = 1 
 +let g:airline_powerline_fonts = 1 
 + 
 +syntax enable 
 +set background=dark 
 +colorscheme solarized 
 + 
 +set encoding=utf-8    
 +"set rop=type:directx,gamma:1.0,contrast:0.5,level:1,geom:1,renmode:4,taamode:
 + 
 +"let g:airline_section_z airline#section#create(['windowswap', '%3p%% ', 'linenr', ':%3v']) 
 + 
 +set nu 
 +set clipboard=unnamed 
 +set laststatus=
 +set lines=50 
 +</sxh> 
 + 
 +  * Plug
 <sxh> <sxh>
 set nocompatible              " be iMproved, required set nocompatible              " be iMproved, required
Line 671: Line 910:
 </sxh> </sxh>
  
 +  * Apply <sxh>
 +:source %
 +:PluginInstall
 +</sxh>
 +
 +
 +
 +===== Examples =====
 +  * '':%s/^(\d+.)/\n\1/g'': 라인 첫번째에 ''숫자(1자이상).''으로 된 항목 앞에 개행문자 추가 (문서전체적용)
 +  * '':%s/^(\s+)*/\1*/g'' : 라인 앞에 ''* '' 추가 (문서전체적용)
 +  * '':%s/^(?:(?:1[6-9]|[2-9]\d)?\d{2})(?:(?:(\/|-|\.)(?:0?[13578]|1[02])\1(?:31))|(?:(\/|-|\.)(?:0?[13-9]|1[0-2])\2(?:29|30)))\$|^(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(\/|-|\.)0?2\3(?:29)\$|^(?:(?:1[6-9]|[2-9]\d)?\d{2})(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:0?[1-9]|1\d|2[0-8])\$/g'' : date validation <sxh regex>
 +/^(?:(?:1[6-9]|[2-9]\d)?\d{2})(?:(?:(\/|-|\.)(?:0?[13578]|1[02])\1(?:31))|(?:(\/|-|\.)(?:0?[13-9]|1[0-2])\2(?:29|30)))$|
 +^(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(\/|-|\.)0?2\3(?:29)$|
 +^(?:(?:1[6-9]|[2-9]\d)?\d{2})(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:0?[1-9]|1\d|2[0-8])$/gm</sxh>
 +  * '':%s/^\d{4}(\-|\/)(0?[1-9]|1[012])(\-|\/)(0[1-9]|[12][0-9]|3[01]|[1-9])'' : 날짜형식  ''yyyy-mm-dd'',  ''yyyy/mm/dd'', ''yyyy/m/d'', ''yyyy-m-d''.
 +
 +  * '':%s/^\d{4}.*$(?:\n\s{2}.*$)+/\0/g'' PTA의 Transaction 단위로. 그룹 지정 안함.
  
 ===== References ===== ===== References =====
 +  *{{youtube>cY0JxzENBJg}} https://youtu.be/cY0JxzENBJg
 +    * command mode / edit mode
 +    * i
 +    * :q, :q!, :w, :w!, :wq, wq!
 +    * <esc> i, a, I, A
 +    * h, j, k, l, 0, $, w, b, 3w, 8w, 
 +    * H 화면위, M 화면 중간, L 화면끝, gg, G, 20G, ^u, ^d, {, } 
 +    * x, dd yy, p, *p
 +    * command + object; d3w, dit, d, y, c, 3w, 3b, aw, at, ap, as, it, i", ip
 +    * ., u, ^R
 +    * **daw** delete a word, di{, di(, da(, di', da', ci[, df(, dt(, d/(sh, d/use
 +    * /, +n, +N
 +    * v, vaw, ^V 
   * [[https://medium.com/sunhyoups-story/vim-%EC%97%90%EB%94%94%ED%84%B0-%EC%9D%B4%EC%81%98%EA%B2%8C-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0-5b6b8d546017|vim 에디터 이쁘게 사용하기]]   * [[https://medium.com/sunhyoups-story/vim-%EC%97%90%EB%94%94%ED%84%B0-%EC%9D%B4%EC%81%98%EA%B2%8C-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0-5b6b8d546017|vim 에디터 이쁘게 사용하기]]
   * [[https://www.lesstif.com/system-admin/vim-42074135.html|vim 메뉴 및 폰트 설정]]   * [[https://www.lesstif.com/system-admin/vim-42074135.html|vim 메뉴 및 폰트 설정]]
Line 682: Line 951:
   * [[https://vlee.kr/1142|VIM 기본 설정과 추천 플러그인 및 사용법 정리]]   * [[https://vlee.kr/1142|VIM 기본 설정과 추천 플러그인 및 사용법 정리]]
   * [[https://agvim.wordpress.com/2017/09/05/vim-plugins-100/|지금 사용하는 Vim 플러그인 100개]]   * [[https://agvim.wordpress.com/2017/09/05/vim-plugins-100/|지금 사용하는 Vim 플러그인 100개]]
 +  * [[https://pastime0.tistory.com/entry/vim|GVIM 환경설정 ]]
 +  * [[https://woonizzooni.tistory.com/entry/Windows10-%ED%99%98%EA%B2%BD%EC%97%90%EC%84%9C-vim-%ED%99%98%EA%B2%BD-%EC%84%A4%EC%A0%95|Windows10 환경에서 vim 환경 설정]]
 +  * [[http://gypark.pe.kr/wiki/Vi%EB%A1%9C%EB%AC%B8%EC%9E%90%EC%97%B4%EC%B9%98%ED%99%98%ED%95%98%EA%B8%B0|Vi로문자열치환하기]]
 +  * [[https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=nahaeya100&logNo=140122974185|이클립스 vRapper 사용하기]]
 +  * [[https://m.blog.naver.com/quantumgaea/222160587948|vimium (chrome extension)]]
 +  * [[https://bluebreeze.co.kr/1356|Practical Vim 2판 정리 페이지 Index]]
 +  * [[https://surpassing.tistory.com/914|Chrome 확장 플러그인 Vimium 커스텀 매핑]]
 +  * [[https://vimium.github.io/|vimium]]
 +  * [[https://github.com/philc/vimium/wiki|philc/vimium @github.com]]
  
  
  • public/computer/vim_cheat_sheet.1647850850.txt.gz
  • Last modified: 2022/03/21 17:20
  • by alex