diff --git a/vim/settings/fugitive.vim b/vim/settings/fugitive.vim index 37bc74c..4287ddf 100644 --- a/vim/settings/fugitive.vim +++ b/vim/settings/fugitive.vim @@ -1,3 +1,18 @@ +" The tree buffer makes it easy to drill down through the directories of your +" git repository, but it’s not obvious how you could go up a level to the +" parent directory. Here’s a mapping of .. to the above command, but +" only for buffers containing a git blob or tree +autocmd User fugitive + \ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' | + \ nnoremap <buffer> .. :edit %:h<CR> | + \ endif + +" Every time you open a git object using fugitive it creates a new buffer. +" This means that your buffer listing can quickly become swamped with +" fugitive buffers. This prevents this from becomming an issue: + +autocmd BufReadPost fugitive://* set bufhidden=delete + " fugitive.git " ======================================== " For fugitive.git, dp means :diffput. Define dg to mean :diffget diff --git a/vim/settings/go.vim b/vim/settings/go.vim new file mode 100644 index 0000000..58ea122 --- /dev/null +++ b/vim/settings/go.vim @@ -0,0 +1,56 @@ +let g:go_fmt_fail_silently = 1 +let g:go_fmt_command = "gofmt" "Explicited the formater plugin (gofmt, goimports, goreturn...) + +" Show a list of interfaces which is implemented by the type under your cursor +au FileType go nmap <Leader>s <Plug>(go-implements) + +" Show type info for the word under your cursor +au FileType go nmap <Leader>i <Plug>(go-info) + +" Open the relevant Godoc for the word under the cursor +au FileType go nmap <Leader>gd <Plug>(go-doc) +au FileType go nmap <Leader>gv <Plug>(go-doc-vertical) + +" Open the Godoc in browser +au FileType go nmap <Leader>gb <Plug>(go-doc-browser) + +" Run/build/test/coverage +au FileType go nmap <leader>r <Plug>(go-run) +au FileType go nmap <leader>b <Plug>(go-build) +au FileType go nmap <leader>t <Plug>(go-test) +au FileType go nmap <leader>c <Plug>(go-coverage) + +" By default syntax-highlighting for Functions, Methods and Structs is disabled. +" Let's enable them! +let g:go_highlight_functions = 1 +let g:go_highlight_methods = 1 +let g:go_highlight_structs = 1 + +nmap <F8> :TagbarToggle<CR> +let g:tagbar_type_go = { + \ 'ctagstype' : 'go', + \ 'kinds' : [ + \ 'p:package', + \ 'i:imports:1', + \ 'c:constants', + \ 'v:variables', + \ 't:types', + \ 'n:interfaces', + \ 'w:fields', + \ 'e:embedded', + \ 'm:methods', + \ 'r:constructor', + \ 'f:functions' + \ ], + \ 'sro' : '.', + \ 'kind2scope' : { + \ 't' : 'ctype', + \ 'n' : 'ntype' + \ }, + \ 'scope2kind' : { + \ 'ctype' : 't', + \ 'ntype' : 'n' + \ }, + \ 'ctagsbin' : 'gotags', + \ 'ctagsargs' : '-sort -silent' +\ } diff --git a/vim/settings/neocomplete.vim b/vim/settings/neocomplete.vim index 56c3eab..992ff83 100644 --- a/vim/settings/neocomplete.vim +++ b/vim/settings/neocomplete.vim @@ -1,18 +1,20 @@ -" Disable AutoComplPop. -let g:acp_enableAtStartup = 0 -" Use neocomplete. -let g:neocomplete#enable_at_startup = 1 +let g:acp_enableAtStartup = 0 " Disable AutoComplPop. +let g:neocomplete#enable_at_startup = 1 " Use neocomplete. let g:neocomplete#enable_camel_case = 1 let g:neocomplete#enable_smart_case = 1 " Default # of completions is 100, that's crazy. let g:neocomplete#max_list = 5 -" Set minimum syntax keyword length. -let g:neocomplete#auto_completion_start_length = 3 +let g:neocomplete#auto_completion_start_length = 3 " Set minimum syntax keyword length. +let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' + +let g:neocomplete#enable_auto_select = 1 " AutoComplPop like behavior. " Map standard Ctrl-N completion to Ctrl-Space inoremap <C-Space> <C-n> +" Plugin key-mappings. +inoremap <expr><C-g> neocomplete#undo_completion() " This makes sure we use neocomplete completefunc instead of " the one in rails.vim, otherwise this plugin will crap out. @@ -24,6 +26,20 @@ if !exists('g:neocomplete#keyword_patterns') endif let g:neocomplete#keyword_patterns['default'] = '\h\w*' +" Enable heavy omni completion. +"if !exists('g:neocomplete#sources#omni#input_patterns') +" let g:neocomplete#sources#omni#input_patterns = {} +"endif +"let g:neocomplete#force_omni_input_patterns.go = '[^.[:digit:] *\t]\.' +if !exists('g:neocomplete#force_omni_input_patterns') + let g:neocomplete#force_omni_input_patterns = {} +endif +let g:neocomplete#force_omni_input_patterns.go = '[^.[:digit:] *\t]\.' + +"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::' +"let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)' +"let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::' + " Enable omni completion. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags @@ -31,3 +47,20 @@ autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS autocmd FileType python setlocal omnifunc=pythoncomplete#Complete autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete + +" Recommended key-mappings. +" <CR>: close popup and save indent. +imap <expr><silent> <CR> <SID>my_cr_function() +function! s:my_cr_function() + return pumvisible() ? neocomplcache#close_popup() . "\<CR>" : "\<CR>" +endfunction + +" <TAB>: completion. +inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" +" <C-h>, <BS>: close popup and delete backword char. +inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>" +inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>" +inoremap <expr><C-y> neocomplete#close_popup() +inoremap <expr><C-e> neocomplete#cancel_popup() +" Close popup by <Space>. +"inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>" diff --git a/vim/settings/syntastic.vim b/vim/settings/syntastic.vim index a069381..bc9e0bb 100644 --- a/vim/settings/syntastic.vim +++ b/vim/settings/syntastic.vim @@ -1,11 +1,11 @@ -"mark syntax errors with :signs -let g:syntastic_enable_signs=1 -"automatically jump to the error when saving the file -let g:syntastic_auto_jump=0 -"show the error list automatically -let g:syntastic_auto_loc_list=1 -"don't care about warnings -let g:syntastic_quiet_messages = {'level': 'warnings'} +let g:syntastic_enable_signs=1 "mark syntax errors with :signs +let g:syntastic_auto_jump=0 "automatically jump to the error when saving the file +let g:syntastic_auto_loc_list=1 "show the error list automatically +let g:syntastic_always_populate_loc_list = 0 +let g:syntastic_quiet_messages = {'level': 'warnings'} "don't care about warnings +let g:syntastic_aggregate_errors = 1 +let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 0 " Default to eslint. If you need jshint, you can override this in " ~/.vimrc.after @@ -15,6 +15,10 @@ let g:syntastic_python_flake8_args='--ignore=F401,F403,F405,W0401,E501' let g:syntastic_python_pylint_post_args="--max-line-length=160" +set statusline+=%#warningmsg# +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* + " I have no idea why this is not working, as it used to " be a part of syntastic code but was apparently removed " This will make syntastic find the correct ruby specified by mri diff --git a/vim/settings/vim-fugitive.vim b/vim/settings/vim-fugitive.vim deleted file mode 100644 index b4ff5a0..0000000 --- a/vim/settings/vim-fugitive.vim +++ /dev/null @@ -1,15 +0,0 @@ -" The tree buffer makes it easy to drill down through the directories of your -" git repository, but it’s not obvious how you could go up a level to the -" parent directory. Here’s a mapping of .. to the above command, but -" only for buffers containing a git blob or tree -autocmd User fugitive - \ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' | - \ nnoremap <buffer> .. :edit %:h<CR> | - \ endif - -" Every time you open a git object using fugitive it creates a new buffer. -" This means that your buffer listing can quickly become swamped with -" fugitive buffers. This prevents this from becomming an issue: - -autocmd BufReadPost fugitive://* set bufhidden=delete - diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index b54787b..afba33a 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -252,6 +252,5 @@ alias top_by_memory="top -o %MEM" alias gcaa="gia .; gcF" alias ror_ctags="ctags -R --languages=ruby --exclude=.git --exclude=log . \$(bundle list --paths)" alias docker_clean_images='docker rmi $(docker images -a --filter=dangling=true -q)' -alias vimgo='vim -u ~/.vimrc.go' alias find_large_files="sudo find / -xdev -type f -size +50M" alias start_polipo='polipo socksParentProxy=localhost:1080'