User Tools

Site Tools


programming:vimrc

This is an old revision of the document!


~/.vimrc
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below.  If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed.  It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
 
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
 
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()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
 
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'tpope/vim-fugitive'
Plugin 'kien/ctrlp.vim'
Plugin 'nvie/vim-flake8'
Plugin 'vim-syntastic/syntastic'
Bundle 'Valloric/YouCompleteMe'
Plugin 'editorconfig/editorconfig-vim'
 
" Plugin 'osfameron/perl-tags-vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
" Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}
 
" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
 
"python with virtualenv support
py << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
  project_base_dir = os.environ['VIRTUAL_ENV']
  activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
  execfile(activate_this, dict(__file__=activate_this))
EOF
 
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g  :YcmCompleter GoToDefinitionElseDeclaration<CR>
 
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
 
" source $VIMRUNTIME/mswin.vim
 
" Use CTRL-S for saving, also in Insert mode
noremap <C-S>        :update<CR>
vnoremap <C-S>        <C-C>:update<CR>
inoremap <C-S>        <C-O>:update<CR>
 
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
 
set enc=UTF-8
 
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
 
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on
 
"This will look in the current directory for "tags", and work up the tree towards root
"until one is found. IOW, you can be anywhere in your source tree instead of just the root of it.
set tags=tags;/
 
 
"set statusline=%F%m%r%h%w\ [%L]\ [%{&ff}]\ %y\ [%p%%]\ [POS=%04l,%04v]\ %{\"[\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\",B\":\"\").\"]\ \"}%k
"              | | | | |    |     |        |    |       |        |      |
"              | | | | |    |     |        |    |       |        |      + Show encoding
"              | | | | |    |     |        |    |       |        + current
"              | | | | |    |     |        |    |       |          column
"              | | | | |    |     |        |    |       +-- current line
"              | | | | |    |     |        |    +-- current % into file
"              | | | | |    |     |        +-- current syntax in
"              | | | | |    |     |            square brackets
"              | | | | |    |     +-- current fileformat
"              | | | | |    +-- number of lines
"              | | | | +-- preview flag in square brackets
"              | | | +-- help flag in square brackets
"              | | +-- readonly flag in square brackets
"              | +-- rodified flag in square brackets
"              +-- full path to file in the buffer
 
" this make the status line to 2 lines hight
set laststatus=2
 
 
set smartindent
 
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark
 
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
    \| exe "normal g'\"" | endif
endif
 
" Uncomment the following to have Vim load indentation rules according to the
" detected filetype. Per default Debian Vim only load filetype specific
" plugins.
if has("autocmd")
  filetype indent on
endif
 
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd        " Show (partial) command in status line.
"set showmatch        " Show matching brackets.
"set ignorecase        " Do case insensitive matching
"set smartcase        " Do smart case matching
"set incsearch        " Incremental search
"set autowrite        " Automatically save before commands like :next and :make
"set hidden             " Hide buffers when they are abandoned
set mouse=a        " Enable mouse usage (all modes) in terminals
 
set showmatch
set showmode
 
set shiftwidth=4
set tabstop=8
set softtabstop=4
"set noexpandtab
set expandtab
 
set noautoindent
 
set nowrap
set colorcolumn=80
 
set wildmode=longest,list " list all possible files|directorys if you open a file with :e or :view or :tabnew
syntax on
 
" Press F4 to toggle highlighting on/off, and show current value.
:noremap <F5> :set hlsearch! hlsearch?<CR>
:nnoremap <F8> :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR>
:nnoremap <F9> :TagbarToggle<CR>
:nmap <F7> :ts <C-R><C-W><CR>
 
"  schaltet die Darstellung von Leerzeichen, TABs und Zeilenenden an/aus:
"  " Interessante Zeichen: ^$¬|÷°~·¨¯_¢¤¥©®<>«»±¶¡¿þÞøæÐרø
"  " Zuerst muss man die Zeichen angeben, die einbezogen werden sollen.
"  set listchars=tab:>-,trail:·,eol:¶,extends:»,precedes:«
"  map        :if &list<CR>set nolist<CR>else<CR>set list<CR>endif<CR><CR>
set listchars=tab:>-,trail:·,eol:¶,extends:»,precedes:«
map  <F10>      :if &list<CR>set nolist<CR>else<CR>set list<CR>endif<CR><CR>
cmap <F10> <ESC>:if &list<CR>set nolist<CR>else<CR>set list<CR>endif<CR><CR>:<up>
imap <F10> <ESC>:if &list<CR>set nolist<CR>else<CR>set list<CR>endif<CR><CR>a
" spell checking
if version >= 700
 
        "let loaded_matchparen = 1
        " turn spelling on by default
        set nospell
    set spellfile="~/.vim/user.add"
        " change to german
        set spelllang=en
    let spellst = ["en"]
        " toggle spelling with F2 key
        map <F3> :set spell!<CR><Bar>:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3)<CR> *]S* <CR>
        " they were using white on white
        highlight PmenuSel ctermfg=black ctermbg=lightgray
        " limit it to just the top 10 items
        set sps=best,5
    " highlighting
    hi SpellBad ctermfg=Red cterm=underline
    hi SpellCap ctermfg=blue cterm=underline
 
    imap <F4> <ESC>z=<CR>i
    nmap <F4> z=
    imap <F5> <ESC>zg<CR>i
    nmap <F5> zg
 
endif
 
map <C-c> "+y<CR>
"map <C-v> "+p<CR>
 
set nocp
filetype plugin on
 
au FileType haskell,vhdl,ada let b:comment_leader = '-- '
au FileType vim let b:comment_leader = '" '
au FileType c,cpp,java let b:comment_leader = '// '
au FileType sh,make let b:comment_leader = '# '
au FileType tex let b:comment_leader = '% '
au BufNewFile,BufRead *.wts set filetype=wlantest
noremap <silent> ,c :<C-B>sil <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:noh<CR>
noremap <silent> ,u :<C-B>sil <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:noh<CR>
 
"Map ;tf to This Function , :;tf followed by a command like %s/// replaces
"only in the current function!!
:cmap ;tf ?^{??(?,/^}/
" Find file in current directory and edit it.
function! Find(...)
    if a:0==2
        let path=a:1
        let query=a:2
    else
        let path="./"
        let query=a:1
    endif
 
    let ignore = " | egrep -v '.git|.svn|CVS|.swp'"
 
    let l:list=system("find ".path." -type f -iname '*".query."*'".ignore)
    let l:num=strlen(substitute(l:list, "[^\n]", "", "g"))
 
    if l:num < 1
        echo "'".query."' not found"
        return
    endif
 
    if l:num == 1
        exe "open " . substitute(l:list, "\n", "", "g")
    else
        let tmpfile = tempname()
        exe "redir! > " . tmpfile
        silent echon l:list
        redir END
        let old_efm = &efm
        set efm=%f
 
        if exists(":cgetfile")
            execute "silent! cgetfile " . tmpfile
        else
            execute "silent! cfile " . tmpfile
        endif
 
        let &efm = old_efm
 
        " Open the quickfix window below the current window
        botright copen
 
        call delete(tmpfile)
    endif
endfunction
 
command! -nargs=* Find :call Find(<f-args>)
 
"colorscheme habiLight
"colorscheme eclipse
 
set clipboard=unnamedplus
 
"execute pathogen#infect()
"
autocmd BufWritePre * %s/\s\+$//e

Install

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall

Install YCM https://github.com/ycm-core/YouCompleteMe#linux-64-bit

sudo apt install build-essential cmake python3-dev
 
cd ~/.vim/bundle/YouCompleteMe
python3 install.py --clang-completer
programming/vimrc.1579899490.txt.gz · Last modified: by clemix

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki