-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
87 lines (72 loc) · 1.84 KB
/
vimrc
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
packadd! onedark.vim
colorscheme onedark
"set swapfile
"set dir=~/tmp
"set backupcopy=yes
set hlsearch
set number
set mouse=a
let mapleader=','
" vv to generate new vertical split
nnoremap <silent> vv <C-w>v
" ctrlp configuration
let g:ctrlp_map = '<c-p>'
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$\|vendor$\|node_modules$',
\ 'file': '\.exe$\|\.so$\|\.dat$'
\ }
" vimux
map <Leader>vp :VimuxPromptCommand<CR>
map <Leader>vl :VimuxRunLastCommand<CR>
" start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
" matchit, better %
runtime macros/matchit.vim
" strip trailing whitespace
function! StripWhitespace ()
let save_cursor = getpos(".")
let old_query = getreg('/')
:%s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfunction
" trialing white space (strip spaces)
noremap <leader>ss :call StripWhitespace()<CR>
fun CopyText(text)
if executable('wl-copy')
silent! call system('wl-copy', a:text)
return 1
elseif executable('xclip')
silent! call system('xclip -sel clip', a:text)
return 1
else
echo "No clipboard command found: wl-copy, xclip."
return 0
endif
endfun
" LSL Optimizer
function CompileLSL()
let lslopt_flags = $LSLOPT_FLAGS
if $lslopt_flags == ""
let $lslopt_flags = "-P \"-I\" -H -O addstrings,-extendedglobalexpr -p gcpp --precmd=cpp"
endif
let out = system($LSL_OPTIMIZER . " " . $lslopt_flags . " " . expand("%:p"))
if v:shell_error != 0
echo out
else
let ret = CopyText(out)
if ret == 1
echo "LSL output copied to clipboard"
endif
endif
endfunction
autocmd FileType lsl nnoremap <F5> :call CompileLSL()<CR>
if &diff
map ] ]c
map [ [c
endif