-
Notifications
You must be signed in to change notification settings - Fork 0
/
.ideavimrc
executable file
·159 lines (113 loc) · 5.76 KB
/
.ideavimrc
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
" Props go to:
" * nvie.com/posts/how-i-boosted-my-vim
" * Fedora base .vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""" HEADER """""""""""""""""""""""""""""""""""""""""""""
" Change the mapleader from \ to , #Note that this needs to be before everything
let mapleader="," " Make life easier.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""" Initialization """""""""""""""""""""""""""""""""""""
" Put everything in a consistent state for plugin enabling
set nocompatible " Because... THIS. IS. VIM.
filetype plugin indent on
syntax on
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""" Change Basic Behavior """"""""""""""""""""""""""""""
set bs=indent,eol,start " Allow backspacing over everything in insert
" mode.
set ignorecase smartcase " Search is now case-insensitive by default, but
" case-sensitive if it contains an upper-case
" symbol.
set formatoptions+=j " Allow removal of comment characters and such
" when merging lines with J.
set wildmenu " Use the wildmenu when doing "open" completions
set wildignore=*.swp,*.bak,*.pyc,*.class
set wildmode=list:longest,full " Default search to both show the completion
" list and auto-complete to longest
" simultaneously.
set hidden " hide buffers instead of closing them
set history=1000 " remember more commands and search history
set nobackup
set undolevels=1000 " use many muchos levels of undo
set noerrorbells " don't beep
set pastetoggle=<F2> " toggle paste mode
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""" Change Visual Behavior """""""""""""""""""""""""""""
set title " Change the terminal's title.
set showmatch " Set show matching parenthesis.
set incsearch " Show search matches as you type.
set hlsearch " highlight the last used search pattern.
nohlsearch " Clear current highlight so 'set hlsearch' doesn't
" actually highlight anything _now_ if .vimrc
" is ever re-sourced.
set scrolloff=1 " Show at least one line above/below cursor.
set showcmd " Show command-mode commands cleanly in the lower right
" e.g. when using c, r, etc., indicate those are in an
" active state while executing.
set list
set listchars=tab:»·,trail:·,extends:#,nbsp:· " Show me tabs and trailing
" whitespace
set ruler " show the cursor position all the time
set relativenumber " Show relative line-number offset from current line
set numberwidth=2 " Reduce gutter size as much as is reasonable
set textwidth=80 " Default to 80 character text width
" Help with line-length visualization.
let &colorcolumn = join(map(range(1,1000), '"+" . v:val'), ",")
" Don't wake up system with blinking cursor:
" http://www.linuxpowertop.org/known.php
set guicursor += ",a:blinkon0"
colorscheme solarized
set background=dark " Dark like cave.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""" Core Remappings """"""""""""""""""""""""""""""""""""
" Give an alternative for having to stretch for ESC. Suggestion by Val Markovic.
inoremap jk <Esc>
" Thank you Val Markovic for pointing out I wasn't doing this in visual mode
" In normal mode, we use : much more often than ; so lets swap them.
" WARNING: this will cause any "ordinary" map command without the "nore" prefix
" that uses ":" to fail. For instance, "map <f2> :w" would fail, since vim will
" read ":w" as ";w" because of the below remappings. Use "noremap"s in such
" situations and you'll be fine.
nnoremap ; :
"nnoremap : ;
vnoremap ; :
vnoremap : ;
" Make moving cursor not jump between newline-delimited lines, but instead do
" so for visual lines
nnoremap j gj
nnoremap k gk
" INSERT A @#$%ing NEWLINE WITHOUT ENTERING INSERT MODE
nnoremap <silent> <CR> o<Esc>
nnoremap <silent> <S-CR> O<Esc>
" Easy window navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
nmap <silent> <leader>/ :nohlsearch<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""" Tabs """""""""""""""""""""""""""""""""""""""""""""""
nmap <silent> <leader>n :tabnew<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""" Indentation """"""""""""""""""""""""""""""""""""""""
set expandtab
set tabstop=4 " a tab is 4 spaces
set softtabstop=4 " so deletion at an initial tab will remove 4 spaces
set shiftwidth=4 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set autoindent " always set autoindenting on
"set copyindent " copy the previous indentation on autoindenting
set smartindent
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""" Misc """""""""""""""""""""""""""""""""""""""""""""""
" Quickly edit/reload the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""