aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2016-09-19 07:03:35 +0200
committerKarel Kočí <cynerd@email.cz>2016-09-19 07:03:35 +0200
commit7f94b21f9764fea1b910ff33027110c733771af6 (patch)
treebab8fb90526f4c63e92515b50a26957c1a445ceb
parent002a7542ceaa825fe14f6701f02b69ce7f9e8ef9 (diff)
parent1f23035b07562b64bb611f48e70080090dcc9bdd (diff)
downloadmyconfigs-7f94b21f9764fea1b910ff33027110c733771af6.tar.gz
myconfigs-7f94b21f9764fea1b910ff33027110c733771af6.tar.bz2
myconfigs-7f94b21f9764fea1b910ff33027110c733771af6.zip
Merge branch 'master' of cynerd.cz:myconfigs
-rw-r--r--.gitmodules3
-rwxr-xr-xlocal/bin/vim-project-gen4
m---------vim/bundle/vim-autotag0
-rw-r--r--vimrc101
-rw-r--r--zshrc3
5 files changed, 57 insertions, 54 deletions
diff --git a/.gitmodules b/.gitmodules
index 507477c..3a6f663 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -34,3 +34,6 @@
[submodule "private"]
path = private
url = git@cynerd.cz:myconfigs-private
+[submodule "vim/bundle/vim-autotag"]
+ path = vim/bundle/vim-autotag
+ url = https://github.com/craigemery/vim-autotag.git
diff --git a/local/bin/vim-project-gen b/local/bin/vim-project-gen
new file mode 100755
index 0000000..6a50ba5
--- /dev/null
+++ b/local/bin/vim-project-gen
@@ -0,0 +1,4 @@
+#!/bin/bash
+# Generates ctags and cscope files for project.
+ctags -R -f .tags
+#cscope -Rbq -f .cscope.out
diff --git a/vim/bundle/vim-autotag b/vim/bundle/vim-autotag
new file mode 160000
+Subproject eabd06dd54536145206c4586c18c51858965386
diff --git a/vimrc b/vimrc
index 63a51ba..9325dfe 100644
--- a/vimrc
+++ b/vimrc
@@ -10,52 +10,75 @@ set exrc
set secure
set title
-function InitBase()
- set tabstop=4
- set softtabstop=4
- set shiftwidth=4
- set noexpandtab
- set number
- set hidden
- set undofile
- set undodir=~/.cache/vim-undo//
- set colorcolumn=82
- set textwidth=82
- highlight ColorColumn ctermbg=darkgray
- set hlsearch
+set hidden
+set undofile
+set undodir=~/.cache/vim-undo//
+set hlsearch
+set foldmethod=syntax
- set foldmethod=syntax
+colorscheme elflord
- execute 'GitGutterEnable'
+" Tabs setting. In default we want 4 spaces tab, but allows also 8 spaced tabs
+set noexpandtab
+set tabstop=4
+set shiftwidth=4
+set softtabstop=4
+function TabToogle()
+ if &tabstop != 4
+ set tabstop=4
+ set shiftwidth=4
+ set softtabstop=4
+ echom 'Tab stop set to 4'
+ else
+ set tabstop=8
+ set shiftwidth=8
+ set softtabstop=8
+ echom 'Tab stop set to 8'
+ endif
+ " Soft tab stop is here only for possibility of expandtab
endfunction
+command TabToogle call TabToogle()
" Write as root
cmap w!! w !sudo tee >/dev/null %
+" netrw configuration
cabbrev E Explore
+let g:netrw_banner=0
+let g:netrw_liststyle=1
+let g:netrw_list_hide='\(^\|\s\s\)\zs\.\S\+'
+" Some fast buffer switching and opening of new files
nnoremap <C-C><CR> :Explore<CR>
nnoremap <C-C>l :bnext<CR>
nnoremap <C-C>h :bprev<CR>
nnoremap <C-C><C-C> :buffers<CR>:buffer<Space>
-let g:netrw_banner=0
-let g:netrw_liststyle=1
-let g:netrw_list_hide='\(^\|\s\s\)\zs\.\S\+'
-
-let g:table_mode_corner="|"
-
-colorscheme elflord
" Directory where *.swp files will be stored
+" Note that double slash is intensional, it tells vim to build complete path.
set directory=$HOME/.cache/vim//
" Setup table-mode to markdown compliant
" Note: to start use "\ t m"
let g:table_mode_corner="|"
+set tags=.tags,./tags
+" Setup autotag to look for .tags file
+let g:autotagTagsFile=".tags"
+
+" Some fast shortcuts
map <F2> :call InitBase()<cr>
+nmap <F9> :TagbarOpen fc<cr>
map <F10> :setlocal spell! spelllang=en_us<cr>
map <F11> :setlocal spell! spelllang=cs<cr>
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+function InitBase()
+ set number
+ set colorcolumn=82
+ set textwidth=82
+ highlight ColorColumn ctermbg=darkgray
+endfunction
+
function InitBash()
call InitBase()
@@ -74,9 +97,6 @@ function InitPython()
unmap <F2>
map <F3> :w<cr>
map <F4> :wa<cr>
- nmap <F9> :TagbarOpen fc<cr>
-
- "execute 'NERDTree'
endfunction
function InitC()
@@ -89,40 +109,13 @@ function InitC()
map <F6> :cp<cr>
map <F7> :cn<cr>
map <F8> :cl<cr>
- nmap <F9> :TagbarOpen fc<cr>
+
+ " TODO check if .tags exists and alternativelly generate
autocmd BufNewFile,BufRead *.c set formatprg=indent\ -kr\ -cp1\ -cd1\ -ts4\ -nut\ -brf
autocmd BufNewFile,BufRead *.cpp set formatprg=indent\ -kr\ -cp1\ -cd1\ -ts4\ -nut\ -brf
autocmd BufNewFile,BufRead *.h set formatprg=indent\ -kr\ -cp0\ -cd1\ -ts4\ -nut\ -brf
autocmd BufNewFile,BufRead *.hpp set formatprg=indent\ -kr\ -cp1\ -cd1\ -ts4\ -nut\ -brf
-
- execute ':silent !ctags -R -f .tags'
- autocmd VimLeave * !rm .tags
-
- execute ':silent !cscope -Rbq -f .cscope.out'
- execute 'cscope add .cscope.out'
- autocmd VimLeave * !rm .cscope*
-
- " cscope maping
- nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
- nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
- nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
- nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
- nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
- nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
- nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
- nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
- nmap <C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
- nmap <C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR>
- nmap <C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR>
- nmap <C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR>
- nmap <C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR>
- nmap <C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR>
- nmap <C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
- nmap <C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
-
-
- execute ':redraw'
endfunction
let g:ycm_path_to_python_interpreter="/usr/bin/python3"
diff --git a/zshrc b/zshrc
index b9c68d1..1ce5fdf 100644
--- a/zshrc
+++ b/zshrc
@@ -28,6 +28,9 @@ setopt hist_ignore_dups
unsetopt nomatch
bindkey -e
+autoload -U select-word-style
+select-word-style bash
+
# Delete key workaround
bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char