Skip to content

Commit

Permalink
for python3
Browse files Browse the repository at this point in the history
  • Loading branch information
lovelock committed Mar 2, 2016
1 parent 9011373 commit e315a10
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions vimrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" tmux
if exists('$ITERM_PROFILE')
if exists('$TMUX')
set term=screen-256color
let &t_SI = "\<Esc>[3 q"
let &t_EI = "\<Esc>[0 q"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
endif

" Sets how many lines of history VIM has to remember
set history=2000

Expand Down Expand Up @@ -459,7 +472,7 @@ function! AutoSetFileHead()
endif

if &filetype == 'python'
call setline(1, "\#!/usr/bin/env python")
call setline(1, "\#!/usr/bin/env python3")
call append(1, "\# encoding: utf-8")
endif

Expand Down Expand Up @@ -501,7 +514,7 @@ func! CompileRun()
elseif &filetype == 'sh'
exec "!time bash %"
elseif &filetype == 'python'
exec "!time python %"
exec "!time python3 %"
elseif &filetype == 'html'
exec "!chrome % &"
elseif &filetype == 'go'
Expand Down Expand Up @@ -582,3 +595,21 @@ function! <SID>BufcloseCloseIt()
execute("bdelete! ".l:currentBufNum)
endif
endfunction

function! WrapForTmux(s)
if !exists('$TMUX')
return a:s
endif
let tmux_start = "\<Esc>Ptmux;"
let tmux_end = "\<Esc>\\"
return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end
endfunction

let &t_SI .= WrapForTmux("\<Esc>[?2004h")
let &t_EI .= WrapForTmux("\<Esc>[?2004l")
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()

0 comments on commit e315a10

Please sign in to comment.