Skip to content

Instantly share code, notes, and snippets.

@taggon
Last active February 1, 2024 12:50
Show Gist options
  • Save taggon/83ab216e5bc4d605eecc15c40ad769e7 to your computer and use it in GitHub Desktop.
Save taggon/83ab216e5bc4d605eecc15c40ad769e7 to your computer and use it in GitHub Desktop.
vim 설정
"=================
" General
"=================
set nocompatible
filetype off
" Set the runtime path to include Vundle and intialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, requried
Plugin 'VundleVim/Vundle.vim'
Plugin 'flazz/vim-colorschemes'
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'godlygeek/tabular'
call vundle#end()
colorscheme badwolf
" Sets how many lines of history VIM has to remember
set history=100
" Set to auto read when a file is changed from the outside
set autoread
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
" Fast saving
nmap <leader>w :w!<CR>
" Tab moves
nmap <leader>[ :tabp<CR>
nmap <leader>] :tabn<CR>
" When vimrc is edited, reload it
autocmd! bufwritepost .vimrc source ~/.vimrc
"=================
" User Interface
"=================
" Set 8 lines to the cursor = when moving vertical
set so=7
set wildmenu " Then on Wild menu
set ruler " Always show current position
set cmdheight=2 " The commandbar height
set hid " Change buffer - without saving
set backspace=eol,start,indent " Set backspace config
set whichwrap+=<,>,h,l
set ignorecase " Ignore case when searching
set smartcase
set hlsearch " Highlight search things
set incsearch " KMake search act like search in modern browsers
set nolazyredraw " Don't redraw while executing macros
set magic " Set magic on, for regular expressions
set showmatch " Show matching brackets when text indicator is over them
set mat=2 " How many tenths of a second to blink
set laststatus=2 " Show status bar
" Indent/Outdent using TAB in visual mode
vmap <Tab> >gv
vmap <S-Tab> <gv
" No sound on errors
set noerrorbells
set novisualbell
set vb t_vb=
set tm=500
" 256 colors
set t_Co=256
" Highlight current line
set cursorline
nnoremap <silent> <leader>c :set cursorline!<CR>
syn on " Syntax on
set nu " Line number
set nuw=5 " Line number width
"=================
" Encodings
"=================
set encoding=utf-8
set fileencodings=utf-8,cp949
set termencoding=utf-8
set ffs=unix,dos,mac " Default file types
"=========================
" Files, backupds and undo
"=========================
" Turn backup off, since most stuff is in git anyway....
set nobackup
set nowb
set noswapfile
"==============================
" Text, tab, and indent related
"==============================
set shiftwidth=4
set tabstop=4
set lbr
set tw=500
set ai " Auto indent
set si " Smart indent
set nowrap " No wrap lines
" Enable filetype plugin
filetype plugin indent on
"===========================
" Session related functions
"===========================
func! SessionSave(...)
let b:sessiondir = $HOME . "/.vim/sessions/"
let b:basename = a:0 == 0 ? "default" : a:1
let b:filename = b:sessiondir . b:basename . ".vim"
if filewritable(b:sessiondir) != 2
exe 'silent !mkdir -p ' b:sessiondir
redraw!
endif
exe 'mksession! ' b:filename
endfunc
command! -nargs=? SessionSave call SessionSave(<args>)
func! SessionLoad(...)
let b:sessiondir = $HOME . "/.vim/sessions/"
let b:basename = a:0 == 0 ? "default" : a:1
let b:filename = b:sessiondir . b:basename . ".vim"
if filereadable(b:filename)
exe 'source ' b:filename
else
echo "No session loaded."
endif
endfunc
command! -nargs=? SessionLoad call SessionLoad(<args>)
@taggon
Copy link
Author

taggon commented Feb 1, 2024

  1. Vundle 먼저 설치
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  1. 플러그인 설치: vim +PluginInstall +qall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment