blob: c604dea9a9ca51b53342436c9a4549de92be0d18 (
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
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
|
" ===========
" VARIABLES
" ===========
set nocompatible
"Disable bell
set vb
set t_vb=
"Search in all of the project tree
set path+=**
set wildmenu
set ttimeoutlen=10
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#whitespace#enabled = 1
let g:airline_powerline_fonts = 1
" Use todo#Complete as the omni complete function for todo files
au filetype todo setlocal omnifunc=todo#Complete
" Auto complete projects
au filetype todo imap <buffer> + +<C-X><C-O>
" Auto complete contexts
au filetype todo imap <buffer> @ @<C-X><C-O>
" leader
let mapleader = "-"
let leader = "-"
let maplocalleader = "-"
execute pathogen#infect()
syntax on
filetype plugin indent on
"Line number Highlight
set nu
highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
" ==============
" SHORTCUTS
" ==============
"Switch windows with keys
nmap <silent> <C-w-k> :wincmd k<CR>
nmap <silent> <C-w-j> :wincmd j<CR>
nmap <silent> <C-w-h> :wincmd h<CR>
nmap <silent> <C-w-l> :wincmd l<CR>
nmap <silent> <F8> :make<CR>
nmap <silent> <F5> :NERDTreeToggle<CR>
nmap <silent> <F6> :TlistToggle<CR>
nmap <silent> <F7> :Newterm<CR>
"Tab mgmt
nmap <silent> <F1> :tabclose<CR>
nmap <silent> <F2> :tabprevious<CR>
nmap <silent> <F3> :tabnext<CR>
nmap <silent> <F4> :tabnew<CR>
" ===========
" COMMANDS
" ===========
command -bar InsertHeader call Fileheader()
function Fileheader()
cursor(1,1)
endfunction
" Command HEXMODE
command -bar Hexmode call ToggleHex()
"^] Jump to tag, ^t jump back
command! MakeTags !ctags -R .
command -bar Newterm call Create_term()
" ===========
" FUNCTIONS
" ===========
function Create_term()
tabnew
terminal
startinsert
endfunction
" helper function to toggle hex mode
function ToggleHex()
" hex mode should be considered a read-only operation
" save values for modified and read-only for restoration later,
" and clear the read-only flag for now
let l:modified=&mod
let l:oldreadonly=&readonly
let &readonly=0
let l:oldmodifiable=&modifiable
let &modifiable=1
if !exists("b:editHex") || !b:editHex
" save old options
let b:oldft=&ft
let b:oldbin=&bin
" set new options
setlocal binary " make sure it overrides any textwidth, etc.
silent :e " this will reload the file without trickeries
"(DOS line endings will be shown entirely )
let &ft="xxd"
" set status
let b:editHex=1
" switch to hex editor
%!xxd
else
" restore old options
let &ft=b:oldft
if !b:oldbin
setlocal nobinary
endif
" set status
let b:editHex=0
" return to normal editing
%!xxd -r
endif
" restore values for modified and read only state
let &mod=l:modified
let &readonly=l:oldreadonly
let &modifiable=l:oldmodifiable
endfunction
|