summaryrefslogtreecommitdiff
path: root/.config/nvim/init.vim
blob: 3c6e9a61ef8a9dcce3655aa4e5f4b060499289fb (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
"""""""
" VIM "
"""""""

set nobackup
set nowb
set noswapfile

""""""""""
" UI "
""""""""""

colorscheme railscasts

" Syntax highlighting on.
syntax on

" Turn on line numbers.
set number

filetype on

filetype plugin on

" Load filetype-specific indent files.
filetype indent on

:set wrap linebreak nolist

" Highlight matching [{()}]
set showmatch

" Open new split panes to right and bottom.
set splitright
set splitbelow

"""""""""""""""""
" SPACES & TABS "
"""""""""""""""""

" Number of visual spaces per tab.
set tabstop=2

" Number of spaces in tab when editing.
set softtabstop=2

" Number of spaces that text is shifted when using << and >>.
set shiftwidth=2

" Tabs are spaces.
set expandtab

"""""""""""""""""
" FINDING FILES "
"""""""""""""""""

" Search down into subfolders.
set path+=**

" Ignore these directories when finding.
set wildignore+=**/.git/**
set wildignore+=**/node_modules/**
set wildignore+=**/vendor/**

" Display all matching files when we tab complete.
set wildmenu

"""""""""""""""
" TAG JUMPING "
"""""""""""""""

" Creates the 'tags' file.
command! MakeTags !ctags -R --exclude@.ctagsignore .

""""""""
" MISC "
""""""""

" 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>