summaryrefslogtreecommitdiff
path: root/.vim/startup/pluginsettings.vim
blob: 633cfe72b4cf53a82f1bf7e27da5126aff43ef65 (plain) (blame)
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
" DelimitMate {{{
	let delimitMate_expand_cr = 1
	" Don't autocomplete diamond brackets in HTML (compatibility with closetag plugin)
	autocmd FileType html let b:delimitMate_matchpairs='(:),[:],{:}'
" }}}

" NERDTree {{{
	" Toggle NERDTree with Tab
	nmap <Tab> :NERDTreeToggle<CR>

	let NERDTreeCustomOpenArgs = {'file':{'where':'t'}} " Open file in new tab, doesn't work only for double-click
	let NERDTreeShowHidden     = 1
	let NERDTreeWinPos         = "right"
	let NERDTreeIgnore         = ['\.swp$', '\~$'] " Ignore file, ending with .swp and ~
" }}}

" Undotree {{{
	" Toggle undotree with F5
	nmap <F5> :UndotreeToggle<CR>  
	
	let g:undotree_WindowLayout       = 2
	let g:undotree_ShortIndicators    = 1 " e.g. using 'd' instead of 'days' to save some space.
	let g:undotree_SetFocusWhenToggle = 1 " if set, let undotree window get focus after being opened, otherwise focus will stay in current window.
	let g:undotree_TreeNodeShape      = '*'
	let g:undotree_DiffCommand        = "diff"
" }}}

" Tabman {{{
	let g:tabman_toggle = '<S-Tab>'
	let g:tabman_side   = 'right'
" }}}

" SuperTab {{{
	let g:SuperTabDefaultCompletionType = "context"
" }}}

" Lightline {{{
	" Settings {{{

		if !has('gui_running')
			set t_Co=256
		endif

		let g:lightline = { 
			\ 'enable': { 
			\   'statusline': 1, 
			\   'tabline': 1 
			\ },
			\ 'colorscheme': 'wombat',
			\ 'active': {
			\   'left': [ [ 'mode', 'paste' ],
			\             [ 'gitbranch', 'filename', 'charvaluehex', 'readonly', 'modified' ] ],
			\   'right': [ [ 'lineinfo' ],
			\              [ 'fileencoding', 'filetype'] ]
			\ },
			\ 'component': {
			\   'charvaluehex': '0x%B',
			\ },
			\ 'component_function': {
			\   'gitbranch': 'LightlineFugitive',
			\   'readonly': 'LightlineReadonly',
			\   'modified': 'LightlineModified',
			\   'filetype': 'LightlineFileType'
			\ },
			\ 'tabline': {
			\   'right': [[]]
			\ },
			\ 'tab': {
			\   'active': [ 'iconFilename','iconReadonly', 'iconModified' ],
			\   'inactive': [ 'iconFilename', 'iconReadonly', 'iconModified' ]
			\ },
			\ 'tab_component_function': {
			\   'iconFilename': 'LightlineTabFilename',
			\   'iconReadonly': 'LightlineTabReadonly',
			\   'iconModified': 'LightlineTabModified'
			\ },
			\ 'separator': { 'left': '', 'right': '' },
			\ 'subseparator': { 'left': '', 'right': '' },
			\ 'tabline_separator': { 'left': '', 'right': '' },
			\ 'tabline_subseparator': { 'left': '' }
		\ }
	" }}}

	" Function overrides {{{
		" Most of the following functions are just modification of source: 
		" Examples from doc file - https://github.com/itchyny/lightline.vim/blob/53176a0b75d6389d775d7bce0d494e58fc654f38/doc/lightline.txt#L583
		" Tab source code - https://github.com/itchyny/lightline.vim/blob/master/autoload/lightline/tab.vim

		function! LightlineFugitive()
			if exists('*FugitiveHead')
				let branch = FugitiveHead()
				return branch !=# '' ? ' '.branch : ''
			endif
				return ''
		endfunction

		function! LightlineReadonly()
			return &ft !~? 'help\|vimfiler' && &readonly ? '' : ''
		endfunction

		function! LightlineModified()
			return &ft =~ 'help\|vimfiler' ? '' : &modified ? '' : &modifiable ? '' : ''
		endfunction

		function! LightlineFileType()
			return strlen(&filetype) ? WebDevIconsGetFileTypeSymbol() . ' ' . &filetype : ''
		endfunction

		" Adds the file type icon in tabs and limit their width
		function! LightlineTabFilename(n) abort
			let buflist = tabpagebuflist(a:n)
			let winnr   = tabpagewinnr(a:n)
			let _       = (expand('#'.buflist[winnr - 1].':t') !=# '' ? expand('#'.buflist[winnr - 1].':t') : '[No Name]')

			" Limit the width of tabs, so they don't go out of the screen
			let tabNameLengthMax = &columns/((tabpagenr('$') > 0 ? tabpagenr('$') : 0) + 5)

			return WebDevIconsGetFileTypeSymbol(_) . ' ' . _[0:tabNameLengthMax]
		endfunction

		function! LightlineTabReadonly(n) abort
			let winnr = tabpagewinnr(a:n)
			return gettabwinvar(a:n, winnr, '&readonly') ? '' : ''
		endfunction

		function! LightlineTabModified(n) abort
			let winnr = tabpagewinnr(a:n)
			return gettabwinvar(a:n, winnr, '&modified') ? '' : gettabwinvar(a:n, winnr, '&modifiable') ? '' : ''
		endfunction
	" }}}
" }}}

" ALE {{{
	map <F2> <ESC>:ALERename<CR>
	map gd <ESC>:ALEGoToDefinition<CR>
	map gi <ESC>:ALEHover<CR>
	map ge <ESC>:ALEDetail<CR>

	set omnifunc=ale#completion#OmniFunc
	let g:ale_completion_enabled = 1

	let g:ale_floating_preview = 1 " Use floating window
	let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰'] " Nicer borders
	
	let g:ale_typescript_tsserver_use_global = 1 " Use global tsserver package
" }}}