summaryrefslogtreecommitdiff
path: root/.vimrc
blob: 928755c13c1ff5fd592b7db54772ed682e7919d6 (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
" Vim configuration file for bdunahu "

" use vim defaults (much better) "
set nocompatible

" allow backspacing over everything in insert mode "
set bs=indent,eol,start

" disable mouse support "
set mouse=

" enable line numbers "
set number relativenumber

" highlight current line "
set cursorline
highlight Cursorline cterm=bold ctermbg=236
highlight Cursor ctermfg=Black ctermbg=Yellow cterm=bold guifg=black guibg=yellow gui=bold

" enable highlight search pattern "
set hlsearch

" enable smartcase search sensitivity "
set ignorecase
set smartcase

" set maximum width of tab character "
set tabstop=4

" set tab key to stop at full tab "
set softtabstop=4

" amount of whitespace to add in normal mode "
set shiftwidth=4

" use space char instead of tab "
set expandtab

" autoindent in new line "
set ai

" show matching pair of () [] {} "
set showmatch

" enable wildmenu "
set wildmenu
set wildmode=longest:full,full
" ignore files with these extensions "
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx

" set folding to indent, but disable nesting "
set foldmethod=indent
set foldnestmax=1

" Only do this part when compiled with support for autocommands
if has("autocmd")
  augroup redhat
  autocmd!
  " In text files, always limit the width of text to 78 characters
  " autocmd BufRead *.txt set tw=78
  " When editing a file, always jump to the last cursor position
  autocmd BufReadPost *
  \ if line("'\"") > 0 && line ("'\"") <= line("$") |
  \   exe "normal! g'\"" |
  \ endif
    " remove trailing whitespace from Python files "
    autocmd BufWritePre *.py :%s/\s\+$//e
  " don't write swapfile on most commonly used directories for NFS mounts or USB sticks
  autocmd BufNewFile,BufReadPre /media/*,/run/media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp
  " start with spec file template
  autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec
  augroup END
endif

if has("cscope") && filereadable("/usr/bin/cscope")
   set csprg=/usr/bin/cscope
   set csto=0
   set cst
   set nocsverb
   " add any database in current directory
   if filereadable("cscope.out")
      cs add $PWD/cscope.out
   " else add database pointed to by environment
   elseif $CSCOPE_DB != ""
      cs add $CSCOPE_DB
   endif
   set csverb
endif

filetype plugin on

" switch syntax highlighting on, when the terminal "
" has colors.
if &t_Co > 2 || has("gui_running")
    syntax on
    set hlsearch
endif

set background=dark
set t_Co=16