blob: d68633aed5dc8d9becdcc5023e16fe70f5d89d82 (
plain)
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
|
""
" Basics
filetype on
set nocompatible
syntax on
set encoding=utf-8
""
" Global stuff
" Show matched result.
set showmatch
" Don't show the current command in the lower right corner.
set showcmd
" Show numbers.
set number
" Don't show the mode, since this will be shown by the status line.
set noshowmode
" Make sure that unsaved buffers that are to be put in the background are
" allowed to go in there (ie. the "must save first" error doesn't come up)
set hidden
" Allow backspacing over everything in insert mode
set backspace=indent,eol,start
" Don't wrap lines
set nowrap
" I don't like the backup and the swapfile thingies.
set nobackup
set noswapfile
""
" Colorscheme
set background=dark
colorscheme xoria256
""
" Setup the cursor for Konsole.
" NOTE: change this if you're not using Konsole or a program that makes use
" of the Konsole part. See
" http://vim.wikia.com/wiki/Change_cursor_shape_in_different_modes
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
""
" Status line
" Returns the mode we are currently.
function! Mode()
redraw
let l:mode = mode()
if mode ==# "n" | return "NORMAL"
elseif mode ==# "i" | return "INSERT"
elseif mode ==# "R" | return "REPLACE"
elseif mode ==# "v" | return "VISUAL"
elseif mode ==# "V" | return "VISUAL-LINE"
elseif mode ==# "" | return "VISUAL-BLOCK"
else | return l:mode
endif
endfunc
" My own status line.
set stl=\ %{Mode()}\ \|\ %f\ %m\ %r\ %=\ Line:\ %l\ Column:\ %v\ Buf:#%n
" Always show the status line.
set laststatus=2
""
" Text Formatting/Layout
set ignorecase
set smartcase
""
" Tabs, Indentation
set textwidth=79
set tabstop=2
set shiftwidth=2
set cindent
set autoindent
set smarttab
set expandtab
set backspace=indent,eol,start
""
" Plugins.
filetype off
filetype indent plugin off
" Using the Go plugins from the official repo.
set runtimepath+=$GOROOT/misc/vim
" All the plugins are listed in my bundles file, that will be installed
" inside the ~/.vim directory.
source ~/.vim/bundles.vim
""
" Filetypes
autocmd FileType ruby set shiftwidth=2
autocmd FileType c set shiftwidth=4 tabstop=4
autocmd FileType yacc set shiftwidth=4 tabstop=4
autocmd FileType go set shiftwidth=4 tabstop=4
""
" Re-mappings
let mapleader = ","
" <C-S> in normal/insert mode: switch to normal mode and write to disk.
inoremap <C-S> <ESC>:w<CR>
nnoremap <C-S> :w<CR>
" <C-A> in normal mode selects the whole text by using visual mode.
nnoremap <C-A> ggVG
|