-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdotvimrc
More file actions
149 lines (130 loc) · 4.52 KB
/
Copy pathdotvimrc
File metadata and controls
149 lines (130 loc) · 4.52 KB
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
"-------------------------------------------------------------
" ,`\ ,`\
" ... / ... /
" @ O O @.' .vimrc/init.vim @ O O @.'
" .' ( o ) .' ( o )
" / ( ) / ( )
" .' \ : / .' \ : /
" nnn nnn nnn nnn
"
"-------------------------------------------------------------
" Key mappings/remappings
"-------------------------------------------------------------
" Autocomplete on tab
:inoremap <tab> <c-n>
" unhighlight current search on Space
map <Space> :noh<cr>
" search & replace whatever is under the cursor
:nnoremap <Leader>s :%s/<C-r><C-w>/
" Tmux slime mappings
:nmap <Leader>c :Tmux make clean<cr>
:nmap <Leader>i :Tmux make ibuild<cr>
:nmap <Leader>b :Tmux make vbuild<cr>
:nmap <Leader>v :Tmux make irun<cr>
:nmap <Leader>r :Tmux make vrun<cr>
:nmap <Leader>k :Tmux make <cr>
" Monkey
let @m="# ,`\\\n# ... /\n# @ O O @.'\n
\# .' ( o )\n#/ ( )\n#\.' \\ : /\n# nnn nnn\n"
:nnoremap <Leader>m 0"mp
"-------------------------------------------------------------
" Behaviour
"-------------------------------------------------------------
filetype on
syntax on
set number " se nonu
set hidden " allow switching away from an unsaved buffer
set shiftwidth=2
set shiftround
set expandtab
set hlsearch
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set cursorline " highlight current line
set showcmd " display incomplete commands
set incsearch " do incremental searching
"-------------------------------------------------------------
" Plugins and other external stuff
"-------------------------------------------------------------
" Set to python2 as that's what most plugins use
let g:python_host_prog = '/usr/bin/python2.7'
let g:loaded_python3_provider = 1
" Plugin manager one-ish liner install:
" curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
call plug#begin()
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-fugitive'
Plug 'godlygeek/tabular'
Plug 'jgdavey/tslime.vim'
Plug 'itchyny/lightline.vim'
Plug 'jacoborus/tender.vim'
Plug 'lervag/vimtex'
Plug 'preservim/nerdtree'
Plug 'vhda/verilog_systemverilog.vim'
call plug#end()
" Settings to enable lightline and disable old mode indicator
set laststatus=2
set noshowmode
let g:lightline = { 'colorscheme': 'ullswater' }
" settings for vimtex
set encoding=utf-8
let g:vimtex_log_verbose = 1
"let g:vimtex_view_general_viewer = 'okular'
" Enable begin/end match jumping with %
runtime macros/matchit.vim
" Recurse upwards to / looking for tags
set tags=./tags;/
set ff=unix
"-------------------------------------------------------------
" Hoop jumps for nice colours in most terminals
"-------------------------------------------------------------
if &term =~ "xterm"
" 256 colours
let &t_Co = 256
" Restore screen after quitting
let &t_ti = "\<Esc>7\<Esc>[r\<Esc>[?47h"
let &t_te = "\<Esc>[?47l\<Esc>8"
if has("terminfo")
let &t_Sf = "\<Esc>[3%p1%dm"
let &t_Sb = "\<Esc>[4%p1%dm"
else
let &t_Sf = "\<Esc>[3%dm"
let &t_Sb = "\<Esc>[4%dm"
endif
endif
colorscheme ullswater
"-------------------------------------------------------------
" Autocmds
"-------------------------------------------------------------
" Remove trailing spaces from all lines prior to saving
fun! <SID>StripTrailSpace()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd BufWritePre * :call <SID>StripTrailSpace()
"-------------------------------------------------------------
" Useful for creating colorschemes
"-------------------------------------------------------------
" Show syntax highlighting groups for word under cursor
nmap <C-S-P> :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
"-------------------------------------------------------------
" Move to the bottom as I probably will never change these
"-------------------------------------------------------------
" Disable cursor keys to annoy others
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>