-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.minvimrc
executable file
·158 lines (117 loc) · 3.36 KB
/
.minvimrc
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
set nocompatible
set encoding=utf-8
" See also https://github.com/dag/vim-fish
if $SHELL =~ 'fish'
set shell=/bin/sh
endif
let mapleader = ","
" Load Vim plugins {{{1
runtime macros/matchit.vim
runtime ftplugin/man.vim
" Behaviour {{{1
filetype indent plugin on
syntax on
set hidden
set wildmenu
set wildmode=longest,list
set incsearch
set hlsearch
set ignorecase
set smartcase
set backspace=indent,eol,start
set gdefault
set nofoldenable
set nojoinspaces
set history=200
set wildignore+=*.class
" Vestiges from http://vim.wikia.com/wiki/Example_vimrc {{{1
" When opening a new line and no filetype-specific indenting is enabled, keep
" the same indent as the line you're currently on. Useful for READMEs, etc.
set autoindent
" Stop certain movements from always going to the first character of a line.
" While this behaviour deviates from that of Vi, it does what most users
" coming from other editors would expect.
set nostartofline
" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking if you wish to save changed files.
set confirm
" Enable use of the mouse for all modes
set mouse=a
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Appearance {{{1
set listchars=tab:▸\ ,eol:¬
set cursorline
set ruler
set laststatus=2
set showcmd
set number
set cmdheight=2
set visualbell
set t_vb=
set scrolloff=5
set sidescroll=1
set sidescrolloff=5
set background=dark
" Indentation {{{1
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
" Mappings {{{1
" Not needed if using "+p
" set pastetoggle=<F11>
map Y y$
nmap <silent> <leader>n :silent :nohlsearch<CR>
map <leader>l :set list!<CR>
map <F7> :set relativenumber!<CR>
" Operate on display lines by default
nnoremap j gj
nnoremap gj j
nnoremap k gk
nnoremap gk k
" Ease 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
nnoremap ]a :next<CR>
nnoremap [a :prev<CR>
nnoremap [A :first<CR>
nnoremap ]A :last<CR>
nnoremap ]t :tnext<CR>
nnoremap [t :tprev<CR>
nnoremap [T :tfirst<CR>
nnoremap ]T :tlast<CR>
" Scroll through history command using Emacs chords while preserving the
" filtering offered by the cursor keys. For example, if the command contains
" ':h ', typing <Up> would only show those commands starting with ':h '.
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
" Lifted from Practical Vim {{{1
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
" Source proj specific setup {{{1
if filereadable(".vimrc.paulcarey.custom")
so .vimrc.paulcarey.custom
endif
" Inline plugins {{{1
" Visual star - * and # search for the visual selection
function! s:VSetSearch()
let temp = @s
norm! gv"sy
let @/ = '\V' . substitute(escape(@s, '/\'), '\n', '\\n', 'g')
let @s = temp
endfunction
xnoremap * :<C-u>call <SID>VSetSearch()<CR>/<C-R>=@/<CR><CR>
xnoremap # :<C-u>call <SID>VSetSearch()<CR>?<C-R>=@/<CR><CR>
" Qargs - populate args with each of the files named in the quickfix list
command! -nargs=0 -bar Qargs execute 'args ' . QuickfixFilenames()
function! QuickfixFilenames()
" Building a hash ensures we get each buffer only once
let buffer_numbers = {}
for quickfix_item in getqflist()
let buffer_numbers[quickfix_item['bufnr']] = bufname(quickfix_item['bufnr'])
endfor
return join(map(values(buffer_numbers), 'fnameescape(v:val)'))
endfunction
let g:netrw_liststyle=4