diff --git a/files/vim/.netrwhist b/files/vim/.netrwhist new file mode 100644 index 0000000..da74a91 --- /dev/null +++ b/files/vim/.netrwhist @@ -0,0 +1,6 @@ +let g:netrw_dirhistmax =10 +let g:netrw_dirhist_cnt =4 +let g:netrw_dirhist_1='/home/lafrite/Cours/Prof/Enseignements/2017-2018/6e' +let g:netrw_dirhist_2='/home/lafrite/Cours/Prof/Enseignements/2017-2018/6e/Nombres_Calculs' +let g:netrw_dirhist_3='/home/lafrite/Cours/Prof/Enseignements/2017-2018/6e/Nombres_Calculs/Numerations_divers' +let g:netrw_dirhist_4='/home/lafrite/scripts/config/vim/bundle/TTCoach/macros/ttcoach/en' diff --git a/files/vim/UltiSnips/python.snippets b/files/vim/UltiSnips/python.snippets new file mode 100644 index 0000000..315772a --- /dev/null +++ b/files/vim/UltiSnips/python.snippets @@ -0,0 +1,19 @@ +snippet todo "A python todo mark" b +# TODO: ${1:desc} |`date` +endsnippet + +snippet tvar "testing a variable" b +print("${1:Varname} -> ", $1) +endsnippet + + +# Unittest + +snippet deftest "test function without docstrings" b +def test_${1:function}(`!p +if snip.indent: + snip.rv = 'self' `): + ${0:pass} +endsnippet + + diff --git a/files/vim/config/base.vim b/files/vim/config/base.vim new file mode 100644 index 0000000..cc2f492 --- /dev/null +++ b/files/vim/config/base.vim @@ -0,0 +1,123 @@ +" Lines number +set number + +" Always show the statusline +set laststatus=2 + +" Necessary to show Unicode glyphs +set encoding=utf8 + +" tab length +set tabstop=4 + +" smart tab +set smartindent + +" Tab to..? +set shiftround + +" Display edition mode +set showmode + +" Ignore case in search mode +set ignorecase + +" Override the 'ignorecase' option if the search pattern +" contains upper case characters. +set smartcase + +" Display uncomplete commands (??) +set showcmd + +" Vim file name completion relative to current file +set autochdir + +" While typing a search command, show immediately where the +" so far typed pattern matches. +set incsearch + +" Use to clear the highlighting of :set hlsearch. +set hlsearch +if maparg('', 'n') ==# '' + nnoremap :nohlsearch=has('diff')?'diffupdate':'' +endif + +" Turn on the WiLd menu +set wildmenu + +" Ignore compiled files +set wildignore=*.o,*~,*.pyc,*.swp + +" Wrap lines +set wrap + +" Turn backup off, since most stuff is in SVN, git et.c anyway... +set nobackup +set noswapfile + +" Having relative number for lines +set relativenumber + +" Display tab and ends of lines +" Shortcut to rapidly toggle `set list` +nmap L :set list! + +" Behaviour of tab +set tabstop =4 +set shiftwidth =4 +set softtabstop =4 +set expandtab + +" Folding +set foldmethod=indent + +" Use the same symbols as TextMate for tabstops and EOLs +" set listchars=tab:▸\ ,eol:¬ +set listchars=nbsp:¤,tab:··,trail:¤,extends:▶,precedes:◀ + +" allow backspacing over everything in insert mode +set backspace=indent,eol,start + +set history=50 " keep 50 lines of command line history +set ruler " show the cursor position all the time +" +" In many terminal emulators the mouse works just fine, thus enable it. +if has('mouse') + set mouse=a +endif + +" Decorations +" ==================== +" Switch syntax highlighting on, when the terminal has colors +" Also switch on highlighting the last used search pattern. +if &t_Co > 2 || has("gui_running") + syntax on +endif + +" When set to "dark", Vim will try to use colors that look +" good on a dark background. When set to "light", Vim will +" try to use colors that look good on a light background. +" Any other value is illegal. +set background=dark + +" Color Scheme +colorscheme zenburn + +set cursorline + +" Align blocks of text and keep them selected +vmap < >gv + +" Spelling +set spelllang=fr +" Set and unset spelling correction +map ":silent setlocal spell! spelllang=en" +map ":silent setlocal spell! spelllang=fr" + +autocmd BufRead,BufNewFile *.{md,tex,rst} setlocal spell + +execute "set colorcolumn=" . join(range(81,335), ',') +" Show what is written! +set conceallevel=0 + diff --git a/files/vim/config/plugins.vim b/files/vim/config/plugins.vim new file mode 100644 index 0000000..d58af9c --- /dev/null +++ b/files/vim/config/plugins.vim @@ -0,0 +1,72 @@ +" Supertab +let g:SuperTabDefaultCompletionType = "context" + +" Ultisnips +let g:ultisnips_python_style='sphinx' +let g:UltiSnipsEditSplit='vertical' +" Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. +" let g:UltiSnipsExpandTrigger="tab" +let g:UltiSnipsExpandTrigger="" + +" Airline +let g:airline_powerline_fonts = 1 +let g:tmuxline_powerline_separators = 0 + +" Nerdtree +let NERDTreeIgnore = ['.pyc$'] +"autocmd VimEnter * NERDTree + +" Vim-notes +let g:notes_directories = ['~/Documents/Notes'] +let g:notes_suffix = '.md' + +" Ale +let g:ale_sign_column_always = 1 +let g:ale_sign_error = '⚑' +let g:ale_sign_warning = '⚐' + +" fzf +" Search and switch buffers +nmap b :Buffers +" Find files by name under the current directory +nmap f :Files +" Find files by name under the home directory +nmap h :Files ~/ +" Search content in the current file +" nmap l :BLines +" Search content in the current file and in files under the current directory +" nmap g :Ag + +" IndentLine +let g:indentLine_fileTypeExclude = ['tex'] +" let g:indentLine_concealcursor = '' +" let g:indentLine_conceallevel = 1 +" +" Vim-polyglot +" let g:LatexBox_no_mappings = 1 +let g:polyglot_disabled = ["latex"] + +" Vimtex +let g:vimtex_compiler_latexmk = { + \ 'backend' : 'jobs', + \ 'background' : 1, + \ 'build_dir' : '', + \ 'callback' : 0, + \ 'continuous' : 1, + \ 'options' : [ + \ '-pdf', + \ '-verbose', + \ '-file-line-error', + \ '-synctex=1', + \ '-interaction=nonstopmode', + \ '-silent', + \ '-shell-escape', + \ ], + \} + +" Les fichiers sty et cls sont vus comme des fichiers tex +autocmd BufRead,BufNewFile *.{sty,cls} setlocal syntax=tex + +autocmd FileType latex unmap ll +autocmd FileType latex nmap ll (vimtex-compile) + diff --git a/files/vim/templates/skeleton.py b/files/vim/templates/skeleton.py new file mode 100644 index 0000000..66e5936 --- /dev/null +++ b/files/vim/templates/skeleton.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# encoding: utf-8 + + +__all__ = [] + + + + + +# ----------------------------- +# Reglages pour 'vim' +# vim:set autoindent expandtab tabstop=4 shiftwidth=4: +# cursor: 16 del diff --git a/files/vimrc b/files/vimrc new file mode 100644 index 0000000..ea892e6 --- /dev/null +++ b/files/vimrc @@ -0,0 +1,106 @@ +set nocompatible " be iMproved, required + +" set the runtime path to include plug.com and initialize +call plug#begin('~/.vim/plugged') + +" Airline statusline +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' + +"" plug.vim management +Plug 'junegunn/vim-plug' + +"" Basic config for vim +Plug 'tpope/vim-sensible' + +" Git integration +Plug 'tpope/vim-fugitive' + +" Nerdtree +Plug 'scrooloose/nerdtree' +"Plug 'jistr/vim-nerdtree-tabs' + +" Supertab (tab instead of ctrl-n or p +Plug 'ervandew/supertab' + +" Special autocompletion +Plug 'SirVer/ultisnips' +Plug 'honza/vim-snippets' +"Plug 'ctrlpvim/ctrlp.vim' +"Plug 'Valloric/YouCompleteMe' + +" Change surround +Plug 'tpope/vim-surround' + +"" Plug vimtex +Plug 'lervag/vimtex' + +" Asynchronous Lint Engine +Plug 'w0rp/ale' + +" Completion for python +Plug 'davidhalter/jedi-vim' + +" Vim note taking plugin +Plug 'xolox/vim-misc' +Plug 'xolox/vim-notes' + +" vuejs syntax +Plug 'posva/vim-vue' + +" Clever substitute +Plug 'tpope/tpope-vim-abolish' + +" Repeat +Plug 'tpope/vim-repeat' + +" Git on lines +Plug 'airblade/vim-gitgutter' + +" Emmet +Plug 'mattn/emmet-vim' + +" Polyglot synthax hightlight autodetect +Plug 'sheerun/vim-polyglot' + +" Show indent lines +Plug 'Yggdroot/indentLine' + +" fzf +Plug 'junegunn/fzf.vim' + +" Tmux integration +Plug 'christoomey/vim-tmux-navigator' + +" Touch typing +" Plug 'vim-scripts/TTCoach' + + +""Plug 'edkolev/tmuxline.vim' +"Plug 'nvie/vim-flake8' +"Plug 'chriskempson/base16-vim' +"Plug 'chase/vim-ansible-yaml' +"Plug 'tmhedberg/SimpylFold' +"Plug 'vim-pandoc/vim-pandoc' +"Plug 'vim-pandoc/vim-pandoc-syntax' +"Plug 'Rykka/riv.vim' +"Plug 'aperezdc/vim-template' +" +" +"" Color scheme +"Plug 'vim-scripts/Wombat' +"Plug 'fugalh/desert.vim' +Plug 'jnurmine/Zenburn' +"Plug 'altercation/vim-colors-solarized' +"Plug 'blockloop/vim-codeschool' +"Plug 'ryanoasis/vim-devicons' + +" All of your Plugs must be added before the following line +call plug#end() " required +" + +" import config from ./config +" runtime! config/**/*.vim +"runtime! config/*.vim +runtime! config/base.vim +runtime! config/plugins.vim diff --git a/tasks/dotfiles.yml b/tasks/dotfiles.yml index 4db78f9..1d2528c 100644 --- a/tasks/dotfiles.yml +++ b/tasks/dotfiles.yml @@ -34,9 +34,31 @@ template: src: files/tmux.conf dest: /home/{{ item.username }}/.tmux.conf + owner: {{ item.username }} with_items: "{{ me }}" - name: Install tmuxinator gem: name: tmuxinator state: latest + +- name: Download plug.vim + get_url: + url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + dest: /home/{{ item.username }}/.vim/autoload/plug.vim + owner: {{ item.username }} + with_items: "{{ me }}" + +- name: Copy vimrc + template: + src: files/vimrc + dest: /home/{{ item.username }}/.vimrc + owner: {{ item.username }} + with_items: "{{ me }}" + +- name: Copy .vim/ + template: + src: files/vim/ + dest: /home/{{ item.username }}/.vim/ + owner: {{ item.username }} + with_items: "{{ me }}"