Commit df00fad5 authored by Moritz Sokoll's avatar Moritz Sokoll 💬
Browse files

added status command

parent 4148a6c3
......@@ -5,7 +5,8 @@
preferred use is with [plugin-manager](https://gitlab.sokoll.com/moritz/vim-plugin-manager). Just download the `git-control.vim` and move it into
`~/.vim/plugins`. Then add the plugin to your plugins list.
## Usage
`vim-git-control` comes with three commands:
`vim-git-control` comes with a few commands:
- `:GitCommit`: prompts the user for a commit message and commits
- `:GitPush`: pushes the current branch
- `:GitPush`: prompts the user for a remote (defaults to origin) and pushes to that remote
- `:GitCheckout`: prompts the use for a branch to checkout to and creates it if it's not existing
- `:GitStatus`: shows the git repository status
......@@ -18,8 +18,15 @@ function! Git_Commit()
endfunction
function! Git_Push()
let stat = system('git push')
echo stat
let remote = input('remote (default is origin): ')
echo ''
if len(remote) == 0
let remote = 'origin'
elseif matchstr(remote, ' ') == ' '
echo 'remote name cannot have a space in it'
return
endif
echo system('git push ' . remote)
endfunction
function! Git_Checkout()
......@@ -35,7 +42,12 @@ function! Git_Checkout()
endif
endfunction
function! Git_Status()
echo system('git status')
endfunction
command! GitCommit call Git_Commit()
command! GitPush call Git_Push()
command! GitCheckout call Git_Checkout()
command! GitStatus call Git_Status()
let g:git_control_loaded = 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment