From 2fb764bc7f4f2ddc18675aa58880630a53cfac0a Mon Sep 17 00:00:00 2001 From: Jannik ZANDER Date: Sat, 2 Jul 2016 11:30:18 +0200 Subject: [PATCH] Block cursor in normal mode in vim --- .config/bash/prompt.bash | 87 +++++++++++++++++++++++++++++++- .vimrc | 105 +++++++++++++++++++++++++++------------ 2 files changed, 160 insertions(+), 32 deletions(-) diff --git a/.config/bash/prompt.bash b/.config/bash/prompt.bash index 40a0a34..85b734a 100644 --- a/.config/bash/prompt.bash +++ b/.config/bash/prompt.bash @@ -27,6 +27,91 @@ fi # (https://github.com/altercation/solarized/tree/master/iterm2-colors-solarized#the-values) set_prompts() { +# GREEN="\[$(tput setaf 2)\]" +# RESET="\[$(tput sgr0)\]" +# +## Reset +#Color_Off="\[\033[0m\]" # Text Reset +# +## Regular Colors +#Black="\[\033[0;30m\]" # Black +#Red="\[\033[0;31m\]" # Red +#Green="\[\033[0;32m\]" # Green +#Yellow="\[\033[0;33m\]" # Yellow +#Blue="\[\033[0;34m\]" # Blue +#Purple="\[\033[0;35m\]" # Purple +#Cyan="\[\033[0;36m\]" # Cyan +#White="\[\033[0;37m\]" # White +# +## Bold +#BBlack="\[\033[1;30m\]" # Black +#BRed="\[\033[1;31m\]" # Red +#BGreen="\[\033[1;32m\]" # Green +#BYellow="\[\033[1;33m\]" # Yellow +#BBlue="\[\033[1;34m\]" # Blue +#BPurple="\[\033[1;35m\]" # Purple +#BCyan="\[\033[1;36m\]" # Cyan +#BWhite="\[\033[1;37m\]" # White +# +## Underline +#UBlack="\[\033[4;30m\]" # Black +#URed="\[\033[4;31m\]" # Red +#UGreen="\[\033[4;32m\]" # Green +#UYellow="\[\033[4;33m\]" # Yellow +#UBlue="\[\033[4;34m\]" # Blue +#UPurple="\[\033[4;35m\]" # Purple +#UCyan="\[\033[4;36m\]" # Cyan +#UWhite="\[\033[4;37m\]" # White +# +## Background +#On_Black="\[\033[40m\]" # Black +#On_Red="\[\033[41m\]" # Red +#On_Green="\[\033[42m\]" # Green +#On_Yellow="\[\033[43m\]" # Yellow +#On_Blue="\[\033[44m\]" # Blue +#On_Purple="\[\033[45m\]" # Purple +#On_Cyan="\[\033[46m\]" # Cyan +#On_White="\[\033[47m\]" # White +# +## High Intensty +#IBlack="\[\033[0;90m\]" # Black +#IRed="\[\033[0;91m\]" # Red +#IGreen="\[\033[0;92m\]" # Green +#IYellow="\[\033[0;93m\]" # Yellow +#IBlue="\[\033[0;94m\]" # Blue +#IPurple="\[\033[0;95m\]" # Purple +#ICyan="\[\033[0;96m\]" # Cyan +#IWhite="\[\033[0;97m\]" # White +# +## Bold High Intensty +#BIBlack="\[\033[1;90m\]" # Black +#BIRed="\[\033[1;91m\]" # Red +#BIGreen="\[\033[1;92m\]" # Green +#BIYellow="\[\033[1;93m\]" # Yellow +#BIBlue="\[\033[1;94m\]" # Blue +#BIPurple="\[\033[1;95m\]" # Purple +#BICyan="\[\033[1;96m\]" # Cyan +#BIWhite="\[\033[1;97m\]" # White +# +## High Intensty backgrounds +#On_IBlack="\[\033[0;100m\]" # Black +#On_IRed="\[\033[0;101m\]" # Red +#On_IGreen="\[\033[0;102m\]" # Green +#On_IYellow="\[\033[0;103m\]" # Yellow +#On_IBlue="\[\033[0;104m\]" # Blue +#On_IPurple="\[\033[10;95m\]" # Purple +#On_ICyan="\[\033[0;106m\]" # Cyan +#On_IWhite="\[\033[0;107m\]" # White +# +## Various variables you might want for your PS1 prompt instead +#Time12h="\T" +#Time12a="\@" +#PathShort="\w" +#PathFull="\W" +#NewLine="\n" +#Jobs="\j" +#export PS1="${GREEN}my prompt${RESET}> " + if [ -x /usr/bin/tput ] && tput setaf 1 >& /dev/null; then bold=$(tput bold) reset=$(tput sgr0) @@ -114,5 +199,5 @@ export HISTSIZE=5000; export HISTCONTROL=ignoreboth:erasedups export HISTIGNORE="ll:ls:cd:cd -:pwd:exit:date:* --help"; # Whenever displaying the prompt, write the previous line to disk -export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" +export PROMPT_COMMAND="history -a" diff --git a/.vimrc b/.vimrc index 77da337..9c11be0 100644 --- a/.vimrc +++ b/.vimrc @@ -20,9 +20,7 @@ set runtimepath+=~/.cache/vim " section: plugins {{{1 " --------------------- -"silent call plug#begin('~/.cache/vim/plugged') - -call plug#begin('~/.cache/vim/plugged') +call plug#begin('~/.cache/vim/bundle') "Plug 'tpope/vim-sensible' "Plug 'tpope/vim-ragtag' Plug 'tpope/vim-repeat' @@ -36,16 +34,18 @@ Plug 'chazy/cscope_maps' Plug 'majutsushi/tagbar' "Plug 'airblade/vim-gitgutter' "Plug 'Lokaltog/powerline',{'rtp': 'powerline/binding/vim/'} -Plug 'junegunn/fzf.vim' +"Plug 'junegunn/fzf.vim' Plug 'thanthese/Tortoise-Typing' Plug 'altercation/vim-colors-solarized' Plug 'editorconfig/editorconfig-vim' Plug 'vim-scripts/a.vim' -Plug 'Shougo/vimfiler.vim' Plug 'Shougo/unite.vim' Plug 'bronson/vim-trailing-whitespace' Plug 'junegunn/vim-easy-align' - +Plug 'kana/vim-tabpagecd' +" Load on nothing +Plug 'SirVer/ultisnips', { 'on': [] } +Plug 'Valloric/YouCompleteMe', { 'on': [] } call plug#end() " section: options {{{1 @@ -61,12 +61,18 @@ endif set cmdheight=2 setglobal commentstring=#\ %s set complete-=i " searching includes can be slow +"if has("win32") || has("win64") +" does not work for msys2 set clipboard=unnamed +"else +"set clipboard=unnamedplus +"endif set fileformats=unix,dos,mac "set foldlevel=99 "set foldmethod=indent set foldmethod=marker set foldopen+=jump +set guioptions+=a set history=200 set incsearch " incremental search set laststatus=2 " always show status line @@ -74,7 +80,7 @@ set lazyredraw set linebreak set mouse=nvi set mousemodel=popup -set pastetoggle= +"set pastetoggle= set printoptions=paper:letter set scrolloff=1 set shiftround @@ -103,7 +109,9 @@ set background=dark set number " plugin settings {{{2 - +let g:netrw_liststyle=3 +let g:netrw_banner = 0 +let g:netrw_sort_sequence = '[\/]$,*' let g:solarized_menu=0 let g:markdown_fenced_languages = ['html', 'python', 'bash=sh'] @@ -111,7 +119,7 @@ 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" +"let g:fzf_launcher = "in_a_new_term_function %s" "for airline "let g:airline#extensions#tabline#enabled = 1 @@ -122,10 +130,16 @@ let g:editorconfig_verbose=0 set colorcolumn=80 highlight ColorColumn ctermbg=9 +" block cursor in normal mode +let &t_ti.="\e[1 q" +let &t_SI.="\e[5 q" +let &t_EI.="\e[1 q" +let &t_te.="\e[0 q" + " }}}2 " section: commands {{{1 "----------------------- -" + if has("cscope") set nocscopetag set cscopequickfix=s-,c-,d-,i-,t-,e- @@ -135,17 +149,6 @@ if has("cscope") 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" @@ -165,22 +168,62 @@ if has("cscope") command! Cscope call Cscoperebuild() endif" -" -" + + " section: mappings {{{1 " ---------------------- +" +let mapleader = "\" -"split navigations -nnoremap -nnoremap -nnoremap -nnoremap +if has("cscope") + 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("") +endif + +" copy/paste from system clipboard +if has("win32") +vnoremap y "*y +vnoremap d "*d +nnoremap p "*p +nnoremap P "*P +vnoremap p "*p +vnoremap P "*P +else +"nnoremap y "*y +"nnoremap p "*p +"nnoremap Y "+y +"nnoremap P "+p +"nnoremap y "*y +"nnoremap yy "*yy +"noremap p "*p +"noremap P "*P +endif + +" cd to same directory as file +nnoremap cd :cd %:p:h:pwd +" source .vimrc +nnoremap v :so ~/.vimrc +" split navigations +nnoremap +nnoremap +nnoremap +nnoremap " folding -nnoremap za +nnoremap za "exit insert mode inoremap jj inoremap j j -map v :so ~/.vimrc +" explorer +"nnoremap e :e . +nnoremap e :Lexplore . " section: autocommands {{{1 " -------------------------- @@ -214,7 +257,7 @@ if (&t_Co > 2 || has("gui_running")) && has("syntax") if !exists('g:colors_name') silent! colorscheme solarized endif - endif +endif " }}}1 if filereadable(expand('~/.vimrc_local')) -- 2.43.0