Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# vim-docker-tools
![demo](https://thumbs.gfycat.com/JitteryHealthyAmericanshorthair-size_restricted.gif)

![demo](https://thumbs.gfycat.com/JitteryHealthyAmericanshorthair-size_restricted.gif)

* Open DockerTools Panel with `:DockerToolsOpen`, close it with `:DockerToolsClose`
* Toggle DockerTools Panel with `:DockerToolsToggle`
* Set Docker daemon host with `:DockerToolsSetHost`
* Support `:ContainerStart`, `:ContainerStop`, `:ContainerRemove`, `:ContainerRestart`, `:ContainerPause`, `:ContainerUnpause`, `:ContainerLogs`. For details please check out the documentation (`:help docker-tools-commands`).
* Autocompletion for container commands
* Full documentation in `:help vim-docker-tools`
# Install

## Install

* Pathogen
* `git clone https://github.com/kevinhui/vim-docker-tools.git ~/.vim/bundle/vim-docker-tools`
* Vim-plug
Expand All @@ -17,5 +21,7 @@
* `Plugin 'kevinhui/vim-docker-tools'`
* Manual
* Copy all of the files into your `~/.vim` directory
# Contributing

## Contributing

Feel free to raise any questions/issues/comments. Submit pull request as you want.
9 changes: 9 additions & 0 deletions autoload/docker_tools.vim
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ function! docker_tools#dt_toggle_help() abort
call s:dt_ui_load()
endfunction

function! docker_tools#dt_attach() abort
if s:dt_container_selected()
let containerid = s:dt_get_id()
call s:term_win_open(printf('%s%s exec -it %s /bin/sh -c "[ -e /bin/bash ] && /bin/bash || /bin/sh"',s:sudo_mode(),g:dockertools_docker_cmd,containerid),containerid)
endif
endfunction

function! docker_tools#dt_toggle_all() abort
let b:show_all_containers = !b:show_all_containers
call s:dt_ui_load()
Expand Down Expand Up @@ -128,6 +135,7 @@ function! s:dt_set_mapping() abort
nnoremap <buffer> <silent> r :call docker_tools#dt_action('restart')<CR>
nnoremap <buffer> <silent> p :call docker_tools#dt_action('pause')<CR>
nnoremap <buffer> <silent> u :call docker_tools#dt_action('unpause')<CR>
nnoremap <buffer> <silent> t :call docker_tools#dt_attach()<CR>
nnoremap <buffer> <silent> > :call docker_tools#dt_run_command()<CR>
nnoremap <buffer> <silent> < :call docker_tools#dt_logs()<CR>
nnoremap <buffer> <silent> a :call docker_tools#dt_toggle_all()<CR>
Expand Down Expand Up @@ -170,6 +178,7 @@ function! s:dt_get_help() abort
let help .= "# x: delete container\n"
let help .= "# p: pause container\n"
let help .= "# u: unpause container\n"
let help .= "# t: attach container window\n"
let help .= "# >: execute command to container\n"
let help .= "# <: show container logs\n"
let help .= "# a: toggle show all/running containers\n"
Expand Down
1 change: 1 addition & 0 deletions doc/vim-docker-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ MAPPINGS *docker-tools-mappings*
x | Delete container.
p | Pause container.
u | Unpause container.
t | Attach container window.
> | Execute command to container.
< | Show container logs.
a | Toggle show all/running containers.
Expand Down