-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc-others
151 lines (118 loc) · 4.22 KB
/
.vimrc-others
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
147
148
149
150
151
if has("gui_running")
" Use the specified location, and suppress the git error.
silent call plug#begin('~/vim/vimfiles/plugged')
else
call plug#begin()
endif
Plug 'morhetz/gruvbox'
Plug 'itchyny/lightline.vim'
call plug#end()
filetype plugin indent on
set nocompatible " Use Vim settings, rather then Vi settings
set ttyfast
set lazyredraw
" Turn off column and cursor highlight when leaving a vim window, and turn them
" on when entering
augroup highlightCursorLine
autocmd!
autocmd WinLeave * set nocursorline nocursorcolumn
autocmd WinEnter * set cursorline cursorcolumn
augroup END
" Start with highlighted columns and lines
set cursorline
set cursorcolumn
set backspace=2 " Backspace deletes like most programs in insert mode
set nobackup
set nowritebackup
" When editing a file, always jump to the last known cursor position.
set history=500
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set hlsearch " highlight matches
set laststatus=2 " Always display the status line
set autowrite " Automatically :write before running commands
set autoread " If the current file is updated elsewhere auto update it
set showmatch " Shows the matching bracket or brace
set nostartofline " when using gg or G, stay in the same column
syntax on
set textwidth=80
set shortmess+=A
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set expandtab
" Display extra white space
set list listchars=tab:>-,trail:-
set encoding=utf-8
" Colour scheme (terminal)
set t_Co=256
set background=dark
colorscheme gruvbox
" With both of these set, I get relative numbers, but the current line gets the
" line number - Hybrid Numbering
set number
set relativenumber
set numberwidth=5
set undolevels=1000
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Use markers for folds
set foldmethod=marker
" Set the gitgutter sign column to be bg0 - same as the background
let g:gruvbox_sign_column="bg0"
" Lightline - Status Bar"{{{
" Use the powerline theme
let g:lightline = {
\ 'colorscheme': 'gruvbox',
\ 'component': {
\ 'fugitive': '%{exists("*fugitive#head")?"BR: " . fugitive#head():""}',
\ 'lineinfo': "LN %l/%{line('$')}",
\ 'colinfo': "COL %-2v",
\ 'charvaluehex' : "char: 0x%B",
\ },
\ 'component_visible_condition': {
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
\ },
\ }
" This is where I define a variable to a function
" I used to use this but I left it here as an example in case I want to use this
" in the future. The total number of lines is done above in lineinfo
" TotalNumberOfLines will contain the number of lines in a file.
" let g:lightline.component_function = {
" \ 'totalNumberOfLines': 'NumberOfLinesFunction',
" \ }
" The layout of lightline when it is the active window
" Left Side
" Mode | Paste Mode || Branch | Read Only | Relative Path | Modified ||
"Right Side
" Format | Encoding | Filetype || Percent || line info | column ||
let g:lightline.active = {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'readonly', 'relativepath', 'modified' ] ],
\ 'right': [ [ 'lineinfo', 'colinfo', 'charvaluehex' ],
\ [ 'percent' ],
\ [ 'fileformat', 'fileencoding', 'filetype' ] ] }
" The layout of lightline when it is not the active window
" Left Side
" Read Only | Relative Path | Modified ||
"Right Side
" Percent || line info | column ||
let g:lightline.inactive = {
\ 'left': [ [ 'readonly', 'relativepath', 'modified' ] ],
\ 'right': [ [ 'lineinfo', 'colinfo', 'charvaluehex' ],
\ [ 'percent' ] ] }
" The layout of lightline for the tab line when tabs exist.
let g:lightline.tabline = {
\ 'left': [ [ 'tabs' ] ] }
"}}}
" trailing white space"{{{
highlight highlighttrailingwhitespace ctermbg=white guibg=white ctermfg=white guifg=white
augroup trailingwhitespacegroup
autocmd!
autocmd bufwinenter * match highlighttrailingwhitespace /\s\+$/
autocmd insertleave * match highlighttrailingwhitespace /\s\+$/
autocmd insertenter * match highlighttrailingwhitespace /\s\+\%#\@<!$/
augroup end
"}}}