-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
75 lines (65 loc) · 4.22 KB
/
.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
set encoding=utf-8
scriptencoding utf-8
"# General Settings
set showcmd " Show command.
set tabstop=4 " Set TAB size.
set softtabstop=4 " TABs to spaces.
set shiftwidth=4 " Spaces for indentation.
set expandtab " Insert appropriate number of spaces.
set autoindent " Auto carry the indentation.
set smartindent " Don't be dumb.
set background=dark " Dark themed FTW.
set nohidden " Close the buffer when another file is opened.
set autoread " Auto update file if changed.
set ruler " Show current line and column position.
set hlsearch " Highlight searching.
set incsearch " Incremental while searching.
nnoremap <leader><space> :nohlsearch<CR> " keybinding to stop highlighting after search
set ignorecase " Don't care about case while searching.
set smartcase " Care about case if uppercase while searching.
set wrapscan " Wrap to start if EOF while searching.
set wrap
set linebreak
set wildmenu " Show all auto complete settings.
set lazyredraw " Need performance for macros.
set foldenable " Enable folding.
set nofoldenable " Unfold all on start.
set foldnestmax=10 " Maximum nested folding limit.
set foldmethod=syntax " Fold based on indentation.
set magic " Better regex.
set number " Show line number on current line.
set relativenumber " Show other line numbers as relatives.
set cursorline " Show selected line
set mouse=c " Disable mouse.
set noswapfile " Don't generate swap files.
set nobackup " Don't generate backup files.
set nowritebackup " Don't write backup files.
set list " Show whitespace characters.
set listchars=tab:»\ ,trail:·,extends:›,precedes:‹,nbsp:· " Fancy characters for whitespaces.
set secure " Don't load random .vimrc from local dir.
set fileformat=unix " Use Unix line endings.
set path+=** " Go into subfolders when searching files.
set clipboard=unnamedplus " Copy to system clipboard
syntax on " Force language syntax highlight.
"let &colorcolumn="120"
set colorcolumn=80 " Set margin.
set termguicolors "
set guifont=Hack:h14
if !has('nvim')
set ttymouse=xterm2
endif
if exists(':tnoremap')
tnoremap <Esc> <C-\><C-n>
endif
autocmd FileType vim setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType markdown setlocal shiftwidth=2 tabstop=2 softtabstop=2
"# Key Mappings
let mapleader=","
nnoremap <leader>w :w<CR>
"# fold .vimrc
augroup vim_folding
autocmd!
autocmd FileType vim set foldmethod=expr foldlevel=0
" note that double quote in foldexpr has to be escaped with backslash
autocmd FileType vim set foldexpr=getline(v:lnum)=~'^\"#'?'>'.(matchend(getline(v:lnum),'\"#*')-1):'='
augroup END