Skip to content

Instantly share code, notes, and snippets.

@ijleesw
Last active July 9, 2019 04:35
Show Gist options
  • Select an option

  • Save ijleesw/c5f7a1b2dc9bb8994c43322c8aa7bbf0 to your computer and use it in GitHub Desktop.

Select an option

Save ijleesw/c5f7a1b2dc9bb8994c43322c8aa7bbf0 to your computer and use it in GitHub Desktop.

Revisions

  1. ijleesw revised this gist Jul 9, 2019. 1 changed file with 34 additions and 10 deletions.
    44 changes: 34 additions & 10 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -10,15 +10,23 @@ endif
    set autoindent
    set cindent
    set smartindent
    set ts=4
    set expandtab
    set softtabstop=4
    set tabstop=4
    set shiftwidth=4
    set expandtab
    set nopaste " default: paste w/o considering indentation

    " C++ indentation
    set cindent
    set cino=:0p0t0(0g1

    " Show line number & curr position
    set nu
    set ru

    " Vertical indentation line
    " omitted

    " Search
    set hlsearch " highlight result
    set ignorecase " ignore case
    @@ -38,7 +46,10 @@ inoremap {<CR> {<CR>}<ESC>O
    set fileencodings=ucs-bom,utf-8,euc-kr,latin1

    " Column limitation
    " set cc=101
    " set cc=81

    " Set ColorColumn color
    highlight ColorColumn ctermbg=6


    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    @@ -55,22 +66,23 @@ autocmd InsertLeave * match ExtraWhitespace /\s\+$/
    autocmd BufWinLeave * call clearmatches()
    " Before a buffer is removed from a window

    " To whow trailing whitespace after some text, use the following;
    " To show trailing whitespace after some text, use the following;
    " /\S\zs\s\+$/


    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Key Mapping
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " <F3> - Add comment
    map <F3> a/*<Space><Space>*/<Left><Left><Left>
    " map <F3> a/*<Space><Space>*/<Left><Left><Left>
    map <F3> I// <ESC>
    imap <F3> /*<Space><Space>*/<Left><Left><Left>
    " <F4> - Trim Whitespace
    "autocmd BufWritePre *.* %s/\s\+$//ge
    " When starting to write the whole buffer to a file
    map <F4> :%s/\s\+$//ge<CR>
    imap <F4> <ESC>:%s/\s\+$//ge<CR>
    map <F4> :%s/\s\+$//ge<CR>:noh<CR>
    imap <F4> <ESC>:%s/\s\+$//ge<CR>:noh<CR>
    " Map key to toggle opt
    function MapToggle(key, opt)
    @@ -81,15 +93,27 @@ endfunction
    command -nargs=+ MapToggle call MapToggle(<f-args>)

    " MapToggle <F9> wrap
    MapToggle <F10> number
    MapToggle <F12> paste
    MapToggle <F5> number
    MapToggle <F6> paste

    " ctags stack pop
    noremap <c-e> <c-]>
    " indentation remap
    inoremap <c-f> <c-t>
    " Move between panes
    map <C-j> <C-W>j
    map <C-k> <C-W>k
    map <C-h> <C-W>h
    map <C-l> <C-W>l
    " Comment out
    " map <C-.> :s/\/\/ //<CR>:noh<CR>
    " imap <C-.> <ESC>:s/\/\/ //<CR>:noh<CR>$i
    " map <S-Right> <S-i>// <ESC>$
    " imap <S-Right> <ESC><S-i>// <ESC>$i

    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Mouse Toggle
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    @@ -105,4 +129,4 @@ function! ToggleMouse()
    endfunc
    map vv :call ToggleMouse()<CR>
    " default : ToggleMouse on()
    call ToggleMouse()
    set mouse=a
  2. ijleesw revised this gist Mar 21, 2019. 1 changed file with 11 additions and 11 deletions.
    22 changes: 11 additions & 11 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -32,6 +32,7 @@ set incsearch " show result w/o <Enter>
    " inoremap { {}<left>
    inoremap {<Space> {<Space>}<left>
    inoremap {<CR> {<CR>}<ESC>O
    " inoremap {;<CR> {<CR>};<ESC>O

    " Encoding
    set fileencodings=ucs-bom,utf-8,euc-kr,latin1
    @@ -61,18 +62,15 @@ autocmd BufWinLeave * call clearmatches()
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Key Mapping
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " <F3> - semi-bracket
    imap <F3> {<CR>}<ESC>O
    " <F3> - Add comment
    map <F3> a/*<Space><Space>*/<Left><Left><Left>
    imap <F3> /*<Space><Space>*/<Left><Left><Left>
    " <F4> - Add comment at the end of current line
    map <F4> <End>a<Tab>/*<Space><Space>*/<Left><Left><Left>
    imap <F4> <End><Tab>/*<Space><Space>*/<Left><Left><Left>
    " <F5> - Trim Whitespace
    " <F4> - Trim Whitespace
    "autocmd BufWritePre *.* %s/\s\+$//ge
    " When starting to write the whole buffer to a file
    map <F5> :%s/\s\+$//ge<CR>
    imap <F5> <ESC>:%s/\s\+$//ge<CR>
    map <F4> :%s/\s\+$//ge<CR>
    imap <F4> <ESC>:%s/\s\+$//ge<CR>
    " Map key to toggle opt
    function MapToggle(key, opt)
    @@ -87,9 +85,11 @@ MapToggle <F10> number
    MapToggle <F12> paste

    " ctags stack pop
    " noremap <c-[> <c-t>
    noremap <c-e> <c-]>
    " indentation remap
    inoremap <c-f> <c-t>
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Mouse Toggle
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    @@ -105,4 +105,4 @@ function! ToggleMouse()
    endfunc
    map vv :call ToggleMouse()<CR>
    " default : ToggleMouse on()
    call ToggleMouse()
    call ToggleMouse()
  3. ijleesw revised this gist Mar 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .vimrc
    Original file line number Diff line number Diff line change
    @@ -30,8 +30,8 @@ set incsearch " show result w/o <Enter>
    " inoremap ( ()<left>
    " inoremap [ []<left>
    " inoremap { {}<left>
    inoremap {<Space> {<Space>}<left>
    inoremap {<CR> {<CR>}<ESC>O
    " inoremap {;<CR> {<CR>};<ESC>O
    " Encoding
    set fileencodings=ucs-bom,utf-8,euc-kr,latin1
  4. ijleesw revised this gist Mar 15, 2019. 1 changed file with 76 additions and 16 deletions.
    92 changes: 76 additions & 16 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -1,48 +1,108 @@
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Basic setting
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Syntax highlighting
    if has ("syntax")
    syntax on
    endif


    " Indentation
    set autoindent
    set cindent

    set smartindent
    set ts=4
    set expandtab
    set shiftwidth=4

    set nopaste " default: paste w/o considering indentation

    " Show line number & curr position
    set nu
    set ru


    " Colorscheme
    " colorscheme jellybeans

    " Search
    set hlsearch " highlight result
    set ignorecase " ignore case
    set incsearch " show result w/o <Enter>

    " Auto braket completion
    " inoremap " ""<left>
    " inoremap ' ''<left>
    " inoremap ( ()<left>
    " inoremap [ []<left>
    inoremap { {}<left>
    " inoremap { {}<left>
    inoremap {<CR> {<CR>}<ESC>O
    inoremap {;<CR> {<CR>};<ESC>O
    " inoremap {;<CR> {<CR>};<ESC>O

    " Encoding
    set fileencodings=ucs-bom,utf-8,euc-kr,latin1


    " Column limitation
    " set cc=101


    " Place cursor where it was before
    au BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \ exe "norm g`\"" |
    \ endif
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " ExtraWhitespace
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen
    match ExtraWhitespace /\s\+$/ " Show trailing whitespace
    autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
    " After a buffer is displayed in a window
    autocmd InsertEnter * match ExtraWhitespace /\s\+\$#\@<!$/
    " When starting Insert mode
    autocmd InsertLeave * match ExtraWhitespace /\s\+$/
    " When leaving Insert mode
    autocmd BufWinLeave * call clearmatches()
    " Before a buffer is removed from a window

    " To whow trailing whitespace after some text, use the following;
    " /\S\zs\s\+$/


    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Key Mapping
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " <F3> - semi-bracket
    imap <F3> {<CR>}<ESC>O
    " <F4> - Add comment at the end of current line
    map <F4> <End>a<Tab>/*<Space><Space>*/<Left><Left><Left>
    imap <F4> <End><Tab>/*<Space><Space>*/<Left><Left><Left>
    " <F5> - Trim Whitespace
    "autocmd BufWritePre *.* %s/\s\+$//ge
    " When starting to write the whole buffer to a file
    map <F5> :%s/\s\+$//ge<CR>
    imap <F5> <ESC>:%s/\s\+$//ge<CR>
    " Map key to toggle opt
    function MapToggle(key, opt)
    let cmd = ':set '.a:opt.'! \| set '.a:opt."?\<CR>"
    exec 'nnoremap '.a:key.' '.cmd
    exec 'inoremap '.a:key." \<C-O>".cmd
    endfunction
    command -nargs=+ MapToggle call MapToggle(<f-args>)

    " MapToggle <F9> wrap
    MapToggle <F10> number
    MapToggle <F12> paste

    " ctags stack pop
    " noremap <c-[> <c-t>
    noremap <c-e> <c-]>
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " Mouse Toggle
    """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    function! ToggleMouse()
    " check if mouse is enabled
    if &mouse == 'a'
    " disable mouse
    set mouse=
    else
    " enable mouse everywhere
    set mouse=a
    endif
    endfunc
    map vv :call ToggleMouse()<CR>
    " default : ToggleMouse on()
    call ToggleMouse()
  5. ijleesw revised this gist Mar 6, 2019. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion .vimrc
    Original file line number Diff line number Diff line change
    @@ -38,4 +38,11 @@ set fileencodings=ucs-bom,utf-8,euc-kr,latin1


    " Column limitation
    " set cc=101
    " set cc=101


    " Place cursor where it was before
    au BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \ exe "norm g`\"" |
    \ endif
  6. ijleesw created this gist Mar 5, 2019.
    41 changes: 41 additions & 0 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    " Syntax highlighting
    if has ("syntax")
    syntax on
    endif


    " Indentation
    set autoindent
    set cindent

    set smartindent
    set ts=4
    set expandtab
    set shiftwidth=4


    " Show line number & curr position
    set nu
    set ru


    " Colorscheme
    " colorscheme jellybeans


    " Auto braket completion
    " inoremap " ""<left>
    " inoremap ' ''<left>
    " inoremap ( ()<left>
    " inoremap [ []<left>
    inoremap { {}<left>
    inoremap {<CR> {<CR>}<ESC>O
    inoremap {;<CR> {<CR>};<ESC>O

    " Encoding
    set fileencodings=ucs-bom,utf-8,euc-kr,latin1


    " Column limitation
    " set cc=101