summaryrefslogtreecommitdiff
path: root/vimrc
blob: 58b2380c599dddf5740aeba72dff0ef89c77d6a4 (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
""" General settings
set autoindent
set backspace=indent,eol,start
set complete-=i      " Set the matches for insert mode completion
set encoding=utf-8   " Set encoding
set expandtab        " Use spaces instead of tabs
set formatoptions+=j " Delete comment character when joining commented lines
set hlsearch         " Highlight all search results
set laststatus=1     " No status line
set ignorecase       " Ignore cases when searching
set incsearch        " Incremental search
set linebreak        " Break lines at word (requires Wrap lines)
set nowrap           " Don't add an actual linebreak when wrapping
set ruler            " Show line & col number of cursor position
set shiftwidth=4     " Number of auto-indent spaces
set showmatch        " Highlight matching brace
set smartcase        " Better searching btw cases
set smartindent      " Autoindent when starting a new line
set smarttab         " Tab insertion & deletion
set tabstop=4        " One tab = 4 spaces
set textwidth=80     " Line wrap (number of cols)
set visualbell       " Use visual bell (no beeping)
set wildmenu         " Helpful completion menu

" Strings to use in 'list' mode and for the :list command
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+

""" Enable syntax
if has('syntax') && !exists('g:syntax_on')
    syntax enable
endif

""" Mappings
imap fd <Esc>
nnoremap ,s :r ~/sig.txt<cr>

" Use <C-L> to clear the highlighting of :set hlsearch.
if maparg('<C-L>', 'n') ==# ''
    nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
endif

""" Easily find cursor with crosshair (\c)
:hi CursorLine   cterm=NONE term=reverse ctermbg=7 guibg=Grey90
:hi CursorColumn cterm=NONE term=reverse ctermbg=7 guibg=Grey90
:nnoremap <Leader>c :set cursorline! cursorcolumn!<CR>

""" File browser
let g:netrw_banner=0       " Disable file browser banner
let g:netrw_liststyle=3    " Tree view

""" CTAGS shortcuts
" open definition in a new tab:
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
" open definition in a vertical split:
map <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>