summaryrefslogtreecommitdiff
path: root/plugin/perso.vim
blob: 9af12b070993e051fd157d21605e45bef36f4b21 (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
set showcmd

set backspace=indent,eol,start

set clipboard=unnamed
set ruler
set t_Co=256
"map <leader>j <C-W>j
"map <leader>k <C-W>k
"map <leader>h <C-W>h
"map <leader>l <C-W>l
filetype plugin indent on

" Color :
colo jellybeans
set cursorline
hi CursorLine term=bold cterm=bold ctermbg=black

" Completion related options
" wildcard char = <TAB>
set wildmenu
set wildmode=list:longest:full

nnoremap <silent><A-o> :set paste<CR>m`o<Esc>``:set nopaste<CR>
nnoremap <silent><A-O> :set paste<CR>m`O<Esc>``:set nopaste<CR>

inoremap <c-e> <Esc>A
inoremap <c-a> <Esc>0i

"Perso C définition"
inoremap prt printf
inoremap swf printf
inoremap #in< #include <><left>
inoremap #in" #include ""<left>
inoremap #def #define 
inoremap #un #undef
inoremap #ifn #ifndef 
inoremap #ifd #ifdef 
inoremap #std #include <stdlib.h>
inoremap #io  #include <stdio.h>

inoremap #main int main(void) {<CR>}<Esc><Up>A
inoremap ##main int main(int argc, char* argv[]) {<CR>}<Esc><Up>A

" Personal shortcurts

ca tn tabnew
ca tc tabc

map <F5> :setlocal spell! spelllang=fr<CR>
map <F6> :setlocal spell! spelllang=en_us<CR>
inoremap <F7> <C-r>=strftime('%F')<CR>
inoremap <F8> <C-r>=strftime('%c')<CR>


" Personal compil shortcurts
map <F9> :make<CR>:cw<CR><CR>
noremap <silent> [q :copen<CR>
noremap <silent> ]q :cclose<CR>
noremap <silent> [Q :cfirst<CR>
noremap <silent> ]Q :clast<CR>
noremap <silent> [[ :cprev<CR>
noremap <silent> ]] :cnext<CR>




"Allow vim clipboad <-> host clipboard to share data
set clipboard=unnamed

" Quick Comment :
autocmd FileType c,cpp,java,go,scala,js   let b:comment_leader = '//'
autocmd FileType sh,ruby,python           let b:comment_leader = '#'
autocmd FileType conf,fstab               let b:comment_leader = '#'
autocmd FileType tex                      let b:comment_leader = '%'
autocmd FileType mail                     let b:comment_leader = '>'
autocmd FileType vim                      let b:comment_leader = '"'
autocmd FileType haskell                  let b:comment_leader = '--'

autocmd FileType c,cpp,java,go,scala  set foldmethod=syntax

noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>


noremap <silent> <c-c><c-c>  :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
noremap <silent> <c-c>c      :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>

nnoremap cd :cd %:p:h<CR>
nnoremap <silent> // :nohls<CR>




" Compil option
autocmd Filetype c call SetCCompiler()
function SetCCompiler()
    if !(filereadable("makefile") || filereadable("Makefile"))
      set makeprg=gcc\ %
    endif
endfunction

autocmd Filetype python call SetPythonCompiler()
function SetPythonCompiler()
    if executable("flake8")
      set makeprg=flake8\ --ignore=E111,E303,E201,E231,E391,E225,E203,E226,W391\ %
    endif
endfunction




noremap <silent> zv :!markdown % \| w3m -I utf-8 -T text/html






set colorcolumn=80
set cursorcolumn
highlight CursorColumn ctermbg=Red
set hls
set incsearch

au BufNewFile *.c 0r ~/.vim/template/skel.c