Skip to content

Instantly share code, notes, and snippets.

@pmaoui
Last active November 9, 2015 08:49
Show Gist options
  • Save pmaoui/3d61534c321b2781694a to your computer and use it in GitHub Desktop.
Save pmaoui/3d61534c321b2781694a to your computer and use it in GitHub Desktop.
Tmux & Vim configuration
# remap prfix to ctrl+a
#set -g prefix C-a
#unbind C-b
#bind C-a send-prefix
# window splitting
unbind %
bind | split-window -h
unbind '"'
bind - split-window -v
# resize panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# move around panes with hjkl, as one would in vim after pressing ctrl-w
set-window-option -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
###########################
# Status Bar
###########################
#run-shell "powerline-daemon -q"
#source "/home/pierrot/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf"
###########################
# Colors
###########################
# color status bar
set -g status-bg colour235
set -g status-fg white
# highlight current window
set-window-option -g window-status-current-fg black
set-window-option -g window-status-current-bg green
# set color of active pane
set -g pane-border-fg colour235
set -g pane-border-bg black
set -g pane-active-border-fg green
set -g pane-active-border-bg black
#copy things
## move x clipboard into tmux paste buffer
bind C-p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
## move tmux copy buffer into x clipboard
bind C-y run "tmux save-buffer - | xclip -i"
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
" On démarre Vundle
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" for plugin, only ' and no "
Plugin 'gmarik/Vundle.vim'
"theme
"Plugin 'tomasr/molokai'
Plugin 'nanotech/jellybeans.vim'
"syntax
Plugin 'jelera/vim-javascript-syntax'
Plugin 'poupougnac/vim-coffee-script'
Plugin 'poupougnac/vim-less'
Plugin 'hail2u/vim-css3-syntax'
Plugin 'othree/html5.vim'
Plugin 'gregsexton/MatchTag'
Plugin 'digitaltoad/vim-jade'
Plugin 'nelstrom/vim-visual-star-search'
Plugin 'kshenoy/vim-signature'
" search using ag (the silver searcher)
" Plugin 'rking/ag.vim'
" syntax checker
Plugin 'scrooloose/syntastic'
"comment lines
Plugin 'scrooloose/nerdcommenter'
" Tab /= align all =
Plugin 'godlygeek/tabular'
"Fuzzy file, buffer, mru, tag, etc finder. http://kien.github.com/ctrlp.vim
Plugin 'kien/ctrlp.vim'
"manage sessions and don't autosave when leaving
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-session'
Plugin 'xolox/vim-shell'
let g:session_autosave = 'no'
"type :ChromeReload to reload Chrome
"Plugin 'lordm/vim-browser-reload-linux'
" Git, what do I have edited ?
Plugin 'airblade/vim-gitgutter'
" Git, more pleasant commit
Plugin 'rhysd/committia.vim'
Plugin 'Shougo/vimproc.vim'
Plugin 'Shougo/vimshell.vim'
" Commitia
"Status line
"set laststatus=2
"Color picker theme
Plugin 'KabbAmine/vCoolor.vim'
let g:vcoolor_map = '<F3>'
"EasyMotion provichriskempson/vim-tomorrow-theme"chriskempson/vim-tomorrow-themedes a much simpler way to use some motions in vim.
" Plugin 'Lokaltog/vim-easymotion'
" type <Leader><Leader>w (,,)
" On active le terminal 256 couleurs
if $COLORTERM == 'mate-terminal'
set t_Co=256
endif
call vundle#end()
filetype plugin indent on
let g:ctrlp_custom_ignore = 'node_modules$\|.DS_Store$\|.git$'
syntax on
" Remove all those lines if you want to change your theme
colorscheme maoui
" GENERAL ABOUT VIM AND CODE
set number " line number
set autoindent
set smartindent
set mouse=a " use mouse
set scrolljump=4 " lines to scroll when cursor leaves screen
set scrolloff=5 " minimum lines to keep above and below cursor
set history=1000
"The current buffer can be put to the background without writing to disk;
"When a background buffer becomes current again, marks and undo-history are remembered.
set hidden
nnoremap ' `
nnoremap ` '
set title
set shortmess=atI
"deal with tabs : http://tedlogan.com/techblog3.html
set tabstop=2 " on en souhaite 2 quand on press tab
set expandtab " Spaces instead of tabs
set shiftwidth=2 " on en souhaite 2 pour l'indentation
"set foldenable " auto fold code
set gdefault " the /g flag on :s substitutions by default
set encoding=utf-8
set fileencodings=utf-8
let mapleader=","
"ABOUT AUTOCOMPLETION
set wildmenu " show list instead of just completing
set wildmode=list:longest,full " comand <Tab> completion, list matches, then longest common part, then all.
"ABOUT SEARCH
set incsearch " find as you type search
set ignorecase " case insensitive search
set smartcase " case sensitive when uc present
nmap <F7> :tabnew /home/pierrot/.vimrc<ENTER>
nmap <F8> :source $MYVIMRC<ENTER>
"Activation de l'autocomplétion
filetype on
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
"autocmd FileType less set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
" non désirable en fin de compte
"autocmd BufEnter * cd %:p:h "faire un cd dans le dossier courant à l'ouverture d'un fichier
au BufNewFile,BufRead *.ejs set filetype=html
au BufNewFile,BufRead *.coffee setl shiftwidth=2 expandtab
au BufNewFile,BufRead *.coffee setf=coffee
" Swap files
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
"Plugin DelimitMate
"let php_sql_query=1
"let php_htmlInStrings=1
" manage split size
noremap <C-S-right> :vertical resize +5<cr>
noremap <C-S-left> :vertical resize -5<cr>
noremap <C-S-top> :horizontal resize +5<cr>
"noremap <C-S-bottom> :horizontal resize -5<cr>
" Coolness from http://stackoverflow.com/questions/290465/vim-how-to-paste-over-without-overwriting-register
function! RestoreRegister()
let @" = s:restore_reg
return ''
endfunction
function! s:Repl()
let s:restore_reg = @"
return "p@=RestoreRegister()\<cr>"
endfunction
" NB: this supports "rp that replaces the selection by the contents of @r
" occur in visual + select
vnoremap <silent> <expr> p <sid>Repl()
" display some syntax elements
map <F2> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
"nmap <F2> :call <SID>SynStack()<CR>
"function! <SID>SynStack()
"if !exists("*synstack")
"return
"endif
"echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
"endfunc
" Great to find hunk (git modified line (with gitgutter))
nmap ]h <Plug>GitGutterNextHunk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment