diff options
| author | Maximilian Möhring | 2024-09-19 10:25:09 +0200 |
|---|---|---|
| committer | Maximilian Möhring | 2024-09-19 10:25:09 +0200 |
| commit | 31dbecc7892afd156a560ee890314e6f2edae4ae (patch) | |
| tree | c332c8cd179e2fdcb30eb1ae72f8be3fb9484cfb | |
| parent | b64441ad8a03eb6a1bc536d169a3e555af3f6bde (diff) | |
| download | ansible-31dbecc7892afd156a560ee890314e6f2edae4ae.tar.gz | |
add vim
| -rw-r--r-- | roles/common-linux/files/.vimrc | 152 | ||||
| -rw-r--r-- | roles/common-linux/tasks/vim.yml | 31 |
2 files changed, 183 insertions, 0 deletions
diff --git a/roles/common-linux/files/.vimrc b/roles/common-linux/files/.vimrc new file mode 100644 index 0000000..990f4d6 --- /dev/null +++ b/roles/common-linux/files/.vimrc @@ -0,0 +1,152 @@ +set nocompatible " be iMproved, required +filetype off " required + +" set the runtime path to include Vundle and initialize +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin()" + +" Manage Plugins +Plugin 'gmarik/Vundle.vim' +" Autocompletion +Plugin 'Valloric/YouCompleteMe' +" Displays Tagbar for Code +Plugin 'majutsushi/tagbar' +" Golang +Plugin 'fatih/vim-go' + +Plugin 'mattn/emmet-vim' +" Filebrowser +Plugin 'scrooloose/nerdtree' +" Open new files in a new tab Plugin 'jistr/vim-nerdtree-tabs' +" Better handling for buffers (opened Files) +Plugin 'vim-scripts/minibufexpl.vim' +" Displays colors in CSS files +Plugin 'ap/vim-css-color' +" More colorschemes available +Plugin 'flazz/vim-colorschemes' +" Autocompletion for HTML5 +Plugin 'othree/html5.vim' +" Better syntax for JavaScript +Plugin 'pangloss/vim-javascript' +" PHP autocompletion +Plugin 'shawncplus/phpcomplete.vim' +" Git integration +"""Plugin 'tpope/vim-fugitive' +" Dim inactive Windows +Plugin 'blueyed/vim-diminactive' +" R support +Plugin 'jalvesaq/Nvim-R' +" Displays cursor line +let g:cursorcross_no_map_BS=1 "Stop annoying message on startup +Plugin 'mtth/cursorcross.vim' +" Zoom in windows +Plugin 'vim-scripts/ZoomWin' +" Debugger +Plugin 'joonty/vdebug' +" Read HN +Plugin 'ryanss/vim-hackernews' +command HN HackerNews +" Change surrounding tags easily like ", ' or <tag> +Plugin 'tpope/vim-surround' +" Shell sugar +Plugin 'tpope/vim-eunuch' +" Markdown +Plugin 'plasticboy/vim-markdown' +" Required for vimshell.vim +Plugin 'Shougo/vimproc.vim' +" Starts a shell session inside a vim window/buffer +Plugin 'Shougo/vimshell.vim' +" https://github.com/cweill/gotests +" https://github.com/buoto/gotests-vim +Plugin 'buoto/gotests-vim' +" Linter framework +Plugin 'neomake/neomake' +" Status line +Plugin 'itchyny/lightline.vim' +" Close Buffers without messing up the layout +Plugin 'moll/vim-bbye' + +call vundle#end() " required +filetype plugin indent on " required + +set number +set ruler +set ignorecase +set hlsearch "highlighted gesuchte wörter +set incsearch +set magic +set showmatch +set autoindent "auto einrücken +set scrolloff=4 "scrollt schon 4 Zeilen vor Ende +set matchpairs=(:),{:},[:],<:> +set t_Co=256 +let g:rehash256 = 1 +colorscheme molokai + +syntax enable +set encoding=utf8 + +"map! jj <ESC> + +" Kein Zusammenklappen +set nofoldenable +set spelllang=de +autocmd FileType markdown setlocal spell +"set spell + +command W w +command Q q +command WQ wq +command Wq wq + +function! ViewHtmlText(url) + if !empty(a:url) + new + setlocal buftype=nofile bufhidden=hide noswapfile + execute 'r !elinks ' . a:url . ' -dump -dump-width ' . winwidth(0) + 1d + endif +endfunction +" Save and view text for current html file. +nnoremap <Leader>H :update<Bar>call ViewHtmlText(expand('%:p'))<CR> +" View text for visually selected url. +vnoremap <Leader>h y:call ViewHtmlText(@@)<CR> +" View text for URL from clipboard. +" On Linux, use @* for current selection or @+ for text in clipboard. +nnoremap <Leader>h :call ViewHtmlText(@+)<CR> +" Close buffer without closing the window +nnoremap <leader>q :bp<cr>:bd #<cr> + +" <leader> ist auf '\' gesetzt + +"cycle through tabs +"map <gn> : tabn<CR> +"map <gt> : tabp<CR> + +" start NERDtree on startup +autocmd vimenter * NERDTree +" close vim when the only open window is NERDtree +" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif " das funktioniert nicht mehr -2016-02-15 +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif +" autofocus on opened file instead of nerdtree +autocmd VimEnter * wincmd p +" Toggle NERDtree +map <C-n> :NERDTreeToggle<CR> +" Run :Neomake on save for PHP files +autocmd BufWritePost *.php Neomake +" autocmd BufWritePost *.php :!php -l % " Executes php -l on every php on save, but it's anoying because the output is not surpressed when no syntax error +" new horizontal splits are on the bottom +set splitbelow +set splitright " new vertical splits are on the right + +" Toggle Tarbar with F9 +nnoremap <silent> <F9> :TagbarToggle<CR> +" start Tagbar on vim start +" autocmd vimenter * Tagbar +" autocmd VimEnter * wincmd p + +" Must be at the end +set background=dark + + " Let :w!! gain sudo privileges without closing and reopening vim +cmap w!! w !sudo tee % >/dev/null" diff --git a/roles/common-linux/tasks/vim.yml b/roles/common-linux/tasks/vim.yml new file mode 100644 index 0000000..1716c03 --- /dev/null +++ b/roles/common-linux/tasks/vim.yml @@ -0,0 +1,31 @@ +- name: mkdir ~root/.vim + file: + path: /root/.vim + state: directory + +- name: mkdir ~horus/.vim + file: + path: /home/horus/.vim + state: directory + +- name: git clone vundle for user + git: + repo: https://github.com/VundleVim/Vundle.vim.git + dest: /home/horus/.vim/bundle/Vundle.vim + +- name: git clone vundle for root + git: + repo: https://github.com/VundleVim/Vundle.vim.git + dest: /root/.vim/bundle/Vundle.vim + +- name: copy .vimrc for ~horus + copy: + src: .vimrc + dest: /home/horus/.vimrc + mode: 744 + +- name: copy .vimrc for ~root + copy: + src: .vimrc + dest: /root/.vimrc + mode: 744 |
