summaryrefslogtreecommitdiff
path: root/.config/nvim/init.vim
blob: 67054967dec1f5432e17a57e1989c4f17e879d4a (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
filetype on
filetype plugin on
filetype indent on " file type based indentation

set nobackup
set nowb
set noswapfile

colorscheme railscasts
syntax on " syntax highlighting on

set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab

set number " turn on line numbers

:set wrap linebreak nolist

" Shortcuts provided by http://vimcasts.org

" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>

" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬

"Invisible character colors
highlight NonText guifg=#4a4a59
highlight SpecialKey guifg=#4a4a59

function! <SID>StripTrailingWhitespaces()
  " Preparation: save last search, and cursor position.
  let _s=@/
  let l = line(".")
  let c = col(".")
  " Do the business:
  %s/\s\+$//e
  " Clean up: restore previous search history, and cursor position
  let @/=_s
  call cursor(l, c)
endfunction
nnoremap <silent> <F5> :call <SID>StripTrailingWhitespaces()<CR>