From: Jannik Zander Date: Sat, 21 May 2016 06:34:13 +0000 (+0200) Subject: Move .vimrc to .config/vim X-Git-Url: https://git.zndr.dk/?a=commitdiff_plain;h=8189befd9cc08264595d50967afc8a406903530e;p=dotfiles.git Move .vimrc to .config/vim --- diff --git a/.config/vim/vimrc b/.config/vim/vimrc new file mode 100644 index 0000000..8251f49 --- /dev/null +++ b/.config/vim/vimrc @@ -0,0 +1,204 @@ +set nocompatible + +if filereadable(expand('$HOME/.config/vim/autoload/plug.vim')) +source $HOME/.config/vim/autoload/plug.vim +call plug#begin('$HOME/.config/vim/plugged') + +"Plug 'tpope/vim-sensible' +"Plug 'tpope/vim-ragtag' +Plug 'tpope/vim-repeat' +Plug 'tpope/vim-surround' +Plug 'tpope/vim-fugitive' +"Plug 'vim-airline/vim-airline' +"Plug 'vim-airline/vim-airline-themes' +"Plug 'mileszs/ack.vim' +Plug 'brandonbloom/csearch.vim' +Plug 'chazy/cscope_maps' +Plug 'majutsushi/tagbar' +"Plug 'airblade/vim-gitgutter' +Plug 'junegunn/fzf.vim' +Plug 'thanthese/Tortoise-Typing' +Plug 'altercation/vim-colors-solarized' +Plug 'editorconfig/editorconfig-vim' +Plug 'scrooloose/nerdtree' +Plug 'vim-scripts/a.vim' + +call plug#end() +endif + +" Section: Options {{{1 +" --------------------- + +set autoindent +set autoread +set autowrite " Automatically save before commands like :next and :make +set backspace=2 +if exists('+breakindent') + set breakindent showbreak=\ + +endif +set cmdheight=2 +setglobal commentstring=#\ %s +set complete-=i " Searching includes can be slow +set fileformats=unix,dos,mac +set foldmethod=marker +set foldopen+=jump +set history=200 +set incsearch " Incremental search +set laststatus=2 " Always show status line +set lazyredraw +set linebreak +set mouse=nvi +set mousemodel=popup +set pastetoggle= +set printoptions=paper:letter +set scrolloff=1 +set shiftround +set showcmd " Show (partial) command in status line. +set showmatch " Show matching brackets. +set sidescrolloff=5 +set smartcase " Case insensitive searches become sensitive with capitals +set smarttab " sw at the start of the line, sts everywhere else +setglobal tags=./tags; +set timeoutlen=1200 " A little bit more time for macros +set ttimeoutlen=50 " Make Esc work faster +if exists('+undofile') + set undofile +endif +"set nobackup +set visualbell +set virtualedit=block +set wildmenu +set wildmode=longest:full,full +set wildignore+=tags,.*.un~,*.pyc +set winaltkeys=no + +if !has("gui_running") && $DISPLAY == '' || !has("gui") + set mouse= +endif +set background=light +set number + +" Plugin Settings {{{2 + + +let g:solarized_menu=0 +let g:markdown_fenced_languages = ['html', 'python', 'bash=sh'] +let g:markdown_syntax_conceal = 0 + +" %s is replaced with fzf command +"let g:fzf_launcher = 'xterm -e bash -ic %s' +let g:fzf_launcher = "In_a_new_term_function %s" + +"For airline +"let g:airline#extensions#tabline#enabled = 1 + +let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] +let g:EditorConfig_verbose=0 +let g:NERDTreeWinSize=30 + +" }}}2 +" Section: Commands {{{1 +"----------------------- +" +if has("cscope") + set nocscopetag + set cscopequickfix=s-,c-,d-,i-,t-,e- + set nocscopeverbose + if filereadable(".git/cscope.out") + cscope add .git/cscope.out + endif + set cscopeverbose + + nnoremap fs :cscope find s =expand(""):botright cwindow + nnoremap fg :cscope find g =expand(""):botright cwindow + nnoremap fc :cscope find c =expand(""):botright cwindow + nnoremap ft :cscope find t =expand(""):botright cwindow + nnoremap fe :cscope find e =expand(""):botright cwindow + nnoremap ff :cscope find f =expand(""):botright cwindow + nnoremap fd :cscope find d =expand(""):botright cwindow + nnoremap fi :cscope find i ^=expand("")$:botright cwindow + "TODO: figure out how to get cstag output in quickfix or a popup menu. + map :cstag =expand("") + + function! CscopeRebuild() + cscope kill .git/cscope.out + silent execute "!./.git/hooks/cscope" + if v:shell_error + redraw! + echohl ErrorMsg | echo "Unable to run cscope command." | echohl None + else + if filereadable(".git/cscope.out") + redraw! + cscope add .git/cscope.out + else + redraw! + echohl ErrorMsg | echo "Unable to read cscope database." | echohl None + endif + endif + endfunction + + command! Cscope call CscopeRebuild() +endif" +" +" +" Section: Mappings {{{1 +" ---------------------- + +inoremap jj +inoremap j j +map +map! +if has("gui_running") + map :Fancy +endif +nmap :if &previewwindowpcloseelseif exists(':Gstatus')exe 'Gstatus'elselsendif +nmap :if exists(':Lcd')exe 'Lcd'elseif exists(':Cd')exe 'Cd'elselcd %:hendif +map :Make +map :Dispatch +map :Start +map v :so ~/.vimrc + + +" Section: Autocommands {{{1 +" -------------------------- +if has("autocmd") + filetype plugin indent on +autocmd BufNewFile,BufReadPost *.md set filetype=markdown +endif " has("autocmd") +" }}}1 +" Section: Visual {{{1 +" -------------------- + +" Switch syntax highlighting on, when the terminal has colors +if (&t_Co > 2 || has("gui_running")) && has("syntax") + function! s:initialize_font() + if exists("&guifont") + if has("mac") + set guifont=Monaco:h12 + elseif has("unix") + if &guifont == "" + set guifont=Monospace\ Medium\ 12 + endif + elseif has("gtk2") + set guifont=Inconsolata\ 12 + elseif has("win32") + set guifont=Consolas:h11,Courier\ New:h10 + endif + endif + endfunction + + + if exists("syntax_on") || exists("syntax_manual") + else + syntax on + endif + set list + if !exists('g:colors_name') + silent! colorscheme solarized + endif + endif +" }}}1 + +if filereadable(expand('$HOME/.config/vim/vimrc_local')) + source $HOME/.config/vim/vimrc_local +endif diff --git a/.vimrc b/.vimrc index 1f1f408..9992293 100644 --- a/.vimrc +++ b/.vimrc @@ -1,13 +1,12 @@ " ~/.vimrc -" Section: Environment {{{1 +set nocompatible set directory=$HOME/.cache/vim/swap set backupdir=$HOME/.cache/vim/backup set undodir=$HOME/.cache/vim/undo set viminfo+=n$HOME/.local/share/vim/viminfo "set rtp=~/$HOME/.config/vim,~/$HOME/.config/vim/after,$VIM,$VIMRUNTIME -set nocompatible if empty(glob('$HOME/.config/vim/autoload/plug.vim')) silent !mkdir -p $HOME/.cache/vim/swap > /dev/null 2>&1 silent !mkdir -p $HOME/.cache/vim/backup > /dev/null 2>&1 @@ -17,204 +16,4 @@ if empty(glob('$HOME/.config/vim/autoload/plug.vim')) autocmd VimEnter * PlugInstall | source $MYVIMRC endif -if filereadable(expand('$HOME/.config/vim/autoload/plug.vim')) -source $HOME/.config/vim/autoload/plug.vim -call plug#begin('$HOME/.config/vim/plugged') - -"Plug 'tpope/vim-sensible' -"Plug 'tpope/vim-ragtag' -Plug 'tpope/vim-repeat' -Plug 'tpope/vim-surround' -Plug 'tpope/vim-fugitive' -"Plug 'vim-airline/vim-airline' -"Plug 'vim-airline/vim-airline-themes' -"Plug 'mileszs/ack.vim' -Plug 'brandonbloom/csearch.vim' -Plug 'chazy/cscope_maps' -Plug 'majutsushi/tagbar' -"Plug 'airblade/vim-gitgutter' -Plug 'junegunn/fzf.vim' -Plug 'thanthese/Tortoise-Typing' -Plug 'altercation/vim-colors-solarized' -Plug 'editorconfig/editorconfig-vim' -Plug 'scrooloose/nerdtree' -Plug 'vim-scripts/a.vim' - -call plug#end() -endif -" Section: Options {{{1 -" --------------------- - -set autoindent -set autoread -set autowrite " Automatically save before commands like :next and :make -set backspace=2 -if exists('+breakindent') - set breakindent showbreak=\ + -endif -set cmdheight=2 -setglobal commentstring=#\ %s -set complete-=i " Searching includes can be slow -set fileformats=unix,dos,mac -set foldmethod=marker -set foldopen+=jump -set history=200 -set incsearch " Incremental search -set laststatus=2 " Always show status line -set lazyredraw -set linebreak -set mouse=nvi -set mousemodel=popup -set pastetoggle= -set printoptions=paper:letter -set scrolloff=1 -set shiftround -set showcmd " Show (partial) command in status line. -set showmatch " Show matching brackets. -set sidescrolloff=5 -set smartcase " Case insensitive searches become sensitive with capitals -set smarttab " sw at the start of the line, sts everywhere else -setglobal tags=./tags; -set timeoutlen=1200 " A little bit more time for macros -set ttimeoutlen=50 " Make Esc work faster -if exists('+undofile') - set undofile -endif -"set nobackup -set visualbell -set virtualedit=block -set wildmenu -set wildmode=longest:full,full -set wildignore+=tags,.*.un~,*.pyc -set winaltkeys=no - -if !has("gui_running") && $DISPLAY == '' || !has("gui") - set mouse= -endif -set background=light -set number - -" Plugin Settings {{{2 - - -let g:solarized_menu=0 -let g:markdown_fenced_languages = ['html', 'python', 'bash=sh'] -let g:markdown_syntax_conceal = 0 - -" %s is replaced with fzf command -"let g:fzf_launcher = 'xterm -e bash -ic %s' -let g:fzf_launcher = "In_a_new_term_function %s" - -"For airline -"let g:airline#extensions#tabline#enabled = 1 - -let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] -let g:EditorConfig_verbose=0 -let g:NERDTreeWinSize=30 - -" }}}2 -" Section: Commands {{{1 -"----------------------- -" -if has("cscope") - set nocscopetag - set cscopequickfix=s-,c-,d-,i-,t-,e- - set nocscopeverbose - if filereadable(".git/cscope.out") - cscope add .git/cscope.out - endif - set cscopeverbose - - nnoremap fs :cscope find s =expand(""):botright cwindow - nnoremap fg :cscope find g =expand(""):botright cwindow - nnoremap fc :cscope find c =expand(""):botright cwindow - nnoremap ft :cscope find t =expand(""):botright cwindow - nnoremap fe :cscope find e =expand(""):botright cwindow - nnoremap ff :cscope find f =expand(""):botright cwindow - nnoremap fd :cscope find d =expand(""):botright cwindow - nnoremap fi :cscope find i ^=expand("")$:botright cwindow - "TODO: figure out how to get cstag output in quickfix or a popup menu. - map :cstag =expand("") - - function! CscopeRebuild() - cscope kill .git/cscope.out - silent execute "!./.git/hooks/cscope" - if v:shell_error - redraw! - echohl ErrorMsg | echo "Unable to run cscope command." | echohl None - else - if filereadable(".git/cscope.out") - redraw! - cscope add .git/cscope.out - else - redraw! - echohl ErrorMsg | echo "Unable to read cscope database." | echohl None - endif - endif - endfunction - - command! Cscope call CscopeRebuild() -endif" -" -" -" Section: Mappings {{{1 -" ---------------------- - -inoremap jj -inoremap j j -map -map! -if has("gui_running") - map :Fancy -endif -nmap :if &previewwindowpcloseelseif exists(':Gstatus')exe 'Gstatus'elselsendif -nmap :if exists(':Lcd')exe 'Lcd'elseif exists(':Cd')exe 'Cd'elselcd %:hendif -map :Make -map :Dispatch -map :Start -map v :so ~/.vimrc - - -" Section: Autocommands {{{1 -" -------------------------- -if has("autocmd") - filetype plugin indent on -autocmd BufNewFile,BufReadPost *.md set filetype=markdown -endif " has("autocmd") -" }}}1 -" Section: Visual {{{1 -" -------------------- - -" Switch syntax highlighting on, when the terminal has colors -if (&t_Co > 2 || has("gui_running")) && has("syntax") - function! s:initialize_font() - if exists("&guifont") - if has("mac") - set guifont=Monaco:h12 - elseif has("unix") - if &guifont == "" - set guifont=Monospace\ Medium\ 12 - endif - elseif has("gtk2") - set guifont=Inconsolata\ 12 - elseif has("win32") - set guifont=Consolas:h11,Courier\ New:h10 - endif - endif - endfunction - - - if exists("syntax_on") || exists("syntax_manual") - else - syntax on - endif - set list - if !exists('g:colors_name') - silent! colorscheme solarized - endif - endif -" }}}1 - -if filereadable(expand('$HOME/.config/vim/vimrc_local')) - source $HOME/.config/vim/vimrc_local -endif +source $HOME/.config/vim/vimrc