summaryrefslogtreecommitdiff
path: root/.vim/vimrc
blob: 19e575e21691b57e2b61a12b5f178f51615e09d0 (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
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

"??let mapleader = ","
execute pathogen#infect()
syntax on
filetype plugin indent on

"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> <C-m> :make<CR>

nmap <silent> <F5> :NERDTreeToggle<CR>
nmap <silent> <F6> :TlistToggle<CR>
nmap <silent> <F7> :Newterm<CR>

command -bar Newterm call Create_term()

function Create_term()
	tabnew
	terminal
	startinsert
endfunction

"Tab mgmt
nmap <silent> <F1> :tabclose<CR>
nmap <silent> <F2> :tabprevious<CR>
nmap <silent> <F3> :tabnext<CR>
nmap <silent> <F4> :tabnew<CR>

"^] Jump to tag, ^t jump back
command! MakeTags !ctags -R .

"Line number Highlight
set nu
highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE

" Command HEXMODE 
command -bar Hexmode call ToggleHex()

" 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