From 7f9136b78d28230cf67df893bf3f0729aca6dc56 Mon Sep 17 00:00:00 2001 From: Ellen Arvidsson Date: Sun, 23 Jun 2019 11:33:39 +0200 Subject: [PATCH] added all current config --- .vimrc | 218 ++++++++++++++++++++++++++++++++++ after/ftplugin/arduino.vim | 3 + after/ftplugin/c.vim | 1 + after/ftplugin/haskell.vim | 6 + after/ftplugin/html.vim | 5 + after/ftplugin/java.vim | 1 + after/ftplugin/javascript.vim | 1 + after/ftplugin/json.vim | 1 + after/ftplugin/p0.vim | 1 + after/ftplugin/php.vim | 1 + after/ftplugin/python.vim | 1 + after/ftplugin/tex.vim | 5 + after/ftplugin/text.vim | 1 + 13 files changed, 245 insertions(+) create mode 100644 .vimrc create mode 100644 after/ftplugin/arduino.vim create mode 100644 after/ftplugin/c.vim create mode 100644 after/ftplugin/haskell.vim create mode 100644 after/ftplugin/html.vim create mode 100644 after/ftplugin/java.vim create mode 100644 after/ftplugin/javascript.vim create mode 100644 after/ftplugin/json.vim create mode 100644 after/ftplugin/p0.vim create mode 100644 after/ftplugin/php.vim create mode 100644 after/ftplugin/python.vim create mode 100644 after/ftplugin/tex.vim create mode 100644 after/ftplugin/text.vim diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..a075fa6 --- /dev/null +++ b/.vimrc @@ -0,0 +1,218 @@ +set nocompatible " be iMproved, required +filetype off " required + +call plug#begin('~/.vim/plugged') + +" Ctrlp for fuzzy file search +Plug 'ctrlpvim/ctrlp.vim' + +" File browser +Plug 'scrooloose/nerdtree' + +" tab support for nerdtree +Plug 'jistr/vim-nerdtree-tabs' + +" Snippet handler +Plug 'SirVer/ultisnips' + +" snippets for ultisnips +Plug 'honza/vim-snippets' + +" supertab for completion +Plug 'ervandew/supertab' + +" YouCompleteMe auto-completion +Plug 'Valloric/YouCompleteMe' + +" More clever matching for % key +Plug 'tmhedberg/matchit' + +" JavaScript syntax highlighting +Plug 'pangloss/vim-javascript' + +" jsx syntax highlighting +Plug 'mxw/vim-jsx' + +" Language server protocol linter +Plug 'w0rp/ale' + +" fugitive.vim git integration +Plug 'tpope/vim-fugitive' + +" Clojure highlight +Plug 'guns/vim-clojure-static' + +" Surround +Plug 'tpope/vim-surround' + +" Repeat of plugin commands +Plug 'tpope/vim-repeat' + +" Ack.vim -- can use ag with this +Plug 'mileszs/ack.vim' + +call plug#end() +" All of your Plugins must be added before the following line + +filetype plugin indent on " required +syntax on + +"Set the status line options.Make it show more information. +set laststatus=2 +set statusline=%{FugitiveStatusline()}\ %F%m%r%h%w\ [BUF=%n]\ [FORMAT=%{&ff}]\ [FO=%{&fo}]\ [TYPE=%Y]\ [POS=%l,%v]\[%p%%]\ %{strftime(\"%d/%m/%y\ -\%H:%M\")} + +"set line no, buffer, search, highlight, autoindent and more. +set nu +set hidden +set ignorecase +set incsearch +set smartcase +set showmatch +" set autoindent +set ruler +set vb +set noerrorbells +set showcmd +set mouse=a +set history=1000 +set undolevels=1000 + +" highlight search results +set hlsearch + +" make delimitMate insert another line when +" closing curlys for example +let delimitMate_expand_cr = 1 + +" make YCM load with python 3 +let g:ycm_server_python_interpreter = '/usr/bin/python2' + +" YCM non-arch package install path to ycm extra conf +"let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py" + +" YCM extra configuration for arch specific YCM package +"let g:ycm_global_ycm_extra_conf = '/usr/share/vim/vimfiles/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py' +"let g:ycm_path_to_python_interpreter = '/usr/bin/python2' + +" Eclim completion method should be set to omnifunc in order to work with YCM +let g:EclimCompletionMethod = 'omnifunc' + +" let syntastic handle the syntax checking +let g:ycm_show_diagnostics_ui = 0 + +" make YCM compatible with UltiSnips (using supertab) +let g:ycm_key_list_select_completion = ['', ''] +let g:ycm_key_list_previous_completion = ['', ''] +let g:SuperTabDefaultCompletionType = '' + +" better key bindings for UltiSnipsExpandTrigger +let g:UltiSnipsExpandTrigger = "" +let g:UltiSnipsJumpForwardTrigger = "" +let g:UltiSnipsJumpBackwardTrigger = "" + +" Leader maps +let mapleader="," +let maplocalleader="\\" +map n NERDTreeTabsToggle + + +autocmd VimEnter * wincmd p + + +"for ino completion +"autocmd BufNewFile,BufRead *.ino setlocal ft=arduino + +" IMPORTANT: grep will sometimes skip displaying the file name if you +" search in a singe file. This will confuse Latex-Suite. Set your grep +" program to always generate a file-name. +" set grepprg=grep\ -nH\ $* + +" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to +" 'plaintex' instead of 'tex', which results in vim-latex not being loaded. +" The following changes the default filetype back to 'tex': +" let g:tex_flavor='latex' + +" Short commands ----------------------- + +" Searching for visually selected text +vnoremap // y/"" + +" For latex compiling +augroup latex_macros " { + autocmd! + autocmd FileType tex :nnoremap c :w :!latexmk -pdf % + autocmd FileType tex :nnoremap v :!evince %:r.pdf & +augroup END " } + +" JavaScript macros +augroup html_macros " { + autocmd! + autocmd FileType html :nnoremap c :w :silent !firefox %:p & +augroup END " } + +augroup javascript_macros " { + autocmd! + autocmd FileType javascript.jsx :nnoremap df :YcmCompleter GoTo +augroup END " } + +" JSON macros +augroup json_macros " { + autocmd! + autocmd FileType json :nnoremap fm :%!python -m json.tool +augroup END " } + +" Function for toggling the relative line numbers +function ToggleRelative() + if &relativenumber==1 + set norelativenumber + else + set relativenumber + endif +endfunction + +" Macros for toggling relative number lines +noremap :call ToggleRelative() +inoremap :call ToggleRelative() + +function GrepAskForDir(specifier) + let cw = expand("") + let cwd = getcwd() + call inputsave() + let dir = input('Grep for word ' . cw . 'in dir: ') + call inputrestore() + execute 'Ack '. a:specifier . ' ' . dir +endfunction + +noremap g :call GrepAskForDir(expand("")) + +" Automatically user relative lines when not in insert mode +au InsertLeave * :set relativenumber +au InsertEnter * :set norelativenumber + + +" Syntastic settings +"let g:syntastic_mode_map = { +" \ "mode": "active", +" \ "passive_filetypes": ["java", "scala"] } + +" Ale linter settings +let g:ale_linters = { +\ 'javascript': ['standard'], +\} +let g:ale_fixers = {'javascript': ['standard']} + +"let g:ale_lint_on_text_changed = 'never' + +" Ctrl-p settings +"let g:ctrlp_max_files = 30000 +let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] + +let g:ale_linters_explicit = 1 + +" hlsearch +noremap h :nohlsearch + +" Ack +if executable('ag') + let g:ackprg = 'ag --vimgrep' +endif diff --git a/after/ftplugin/arduino.vim b/after/ftplugin/arduino.vim new file mode 100644 index 0000000..63f124e --- /dev/null +++ b/after/ftplugin/arduino.vim @@ -0,0 +1,3 @@ +set softtabstop=8 tabstop=8 noexpandtab + +set cindent diff --git a/after/ftplugin/c.vim b/after/ftplugin/c.vim new file mode 100644 index 0000000..520e290 --- /dev/null +++ b/after/ftplugin/c.vim @@ -0,0 +1 @@ +set softtabstop=4 shiftwidth=4 expandtab diff --git a/after/ftplugin/haskell.vim b/after/ftplugin/haskell.vim new file mode 100644 index 0000000..109cd5b --- /dev/null +++ b/after/ftplugin/haskell.vim @@ -0,0 +1,6 @@ +" Tab specific option +set tabstop=8 "A tab is 8 spaces +set expandtab "Always uses spaces instead of tabs +set softtabstop=4 "Insert 4 spaces when tab is pressed +set shiftwidth=4 "An indent is 4 spaces +set shiftround "Round indent to nearest shiftwidth multiple diff --git a/after/ftplugin/html.vim b/after/ftplugin/html.vim new file mode 100644 index 0000000..a101bf0 --- /dev/null +++ b/after/ftplugin/html.vim @@ -0,0 +1,5 @@ +let g:html_indent_inctags = "html,body,head,tbody" +let g:html_indent_script1 = "inc" +let g:html_indent_style1 = "inc" + +set softtabstop=2 shiftwidth=2 expandtab diff --git a/after/ftplugin/java.vim b/after/ftplugin/java.vim new file mode 100644 index 0000000..520e290 --- /dev/null +++ b/after/ftplugin/java.vim @@ -0,0 +1 @@ +set softtabstop=4 shiftwidth=4 expandtab diff --git a/after/ftplugin/javascript.vim b/after/ftplugin/javascript.vim new file mode 100644 index 0000000..659b14e --- /dev/null +++ b/after/ftplugin/javascript.vim @@ -0,0 +1 @@ +set softtabstop=2 shiftwidth=2 expandtab diff --git a/after/ftplugin/json.vim b/after/ftplugin/json.vim new file mode 100644 index 0000000..659b14e --- /dev/null +++ b/after/ftplugin/json.vim @@ -0,0 +1 @@ +set softtabstop=2 shiftwidth=2 expandtab diff --git a/after/ftplugin/p0.vim b/after/ftplugin/p0.vim new file mode 100644 index 0000000..659b14e --- /dev/null +++ b/after/ftplugin/p0.vim @@ -0,0 +1 @@ +set softtabstop=2 shiftwidth=2 expandtab diff --git a/after/ftplugin/php.vim b/after/ftplugin/php.vim new file mode 100644 index 0000000..8edfdc8 --- /dev/null +++ b/after/ftplugin/php.vim @@ -0,0 +1 @@ +set softtabstop=8 shiftwidth=8 noexpandtab diff --git a/after/ftplugin/python.vim b/after/ftplugin/python.vim new file mode 100644 index 0000000..520e290 --- /dev/null +++ b/after/ftplugin/python.vim @@ -0,0 +1 @@ +set softtabstop=4 shiftwidth=4 expandtab diff --git a/after/ftplugin/tex.vim b/after/ftplugin/tex.vim new file mode 100644 index 0000000..3a55ffd --- /dev/null +++ b/after/ftplugin/tex.vim @@ -0,0 +1,5 @@ +set textwidth=80 + +set softtabstop=2 shiftwidth=2 expandtab + +set iskeyword+=: diff --git a/after/ftplugin/text.vim b/after/ftplugin/text.vim new file mode 100644 index 0000000..675a390 --- /dev/null +++ b/after/ftplugin/text.vim @@ -0,0 +1 @@ +set textwidth=80