From 602509fa954281c81689d1f9dcb8eb95acd75b1f Mon Sep 17 00:00:00 2001 From: Danilo Lutz Date: Wed, 19 Feb 2020 01:01:42 -0300 Subject: [PATCH 1/3] -mFeat: Attach container window --- autoload/docker_tools.vim | 9 +++++++++ doc/vim-docker-tools.txt | 1 + 2 files changed, 10 insertions(+) diff --git a/autoload/docker_tools.vim b/autoload/docker_tools.vim index 4de1d4a..e1a8b4b 100644 --- a/autoload/docker_tools.vim +++ b/autoload/docker_tools.vim @@ -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() @@ -128,6 +135,7 @@ function! s:dt_set_mapping() abort nnoremap r :call docker_tools#dt_action('restart') nnoremap p :call docker_tools#dt_action('pause') nnoremap u :call docker_tools#dt_action('unpause') + nnoremap t :call docker_tools#dt_attach() nnoremap > :call docker_tools#dt_run_command() nnoremap < :call docker_tools#dt_logs() nnoremap a :call docker_tools#dt_toggle_all() @@ -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" diff --git a/doc/vim-docker-tools.txt b/doc/vim-docker-tools.txt index 5ee0b8a..e099984 100644 --- a/doc/vim-docker-tools.txt +++ b/doc/vim-docker-tools.txt @@ -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. From a901a1eec43020b90d6d8629df961a8240524656 Mon Sep 17 00:00:00 2001 From: Danilo Lutz Date: Wed, 19 Feb 2020 01:16:48 -0300 Subject: [PATCH 2/3] Fix: readme --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1edfb07..fdfb306 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,18 @@ # 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` + * `git clone https://github.com/danilolutz/vim-docker-tools.git ~/.vim/bundle/vim-docker-tools` * Vim-plug * `Plug 'kevinhui/vim-docker-tools'` * NeoBundle @@ -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. From 6dbc4ab50a6f0045263be31bb62d4fb3f9ec32e0 Mon Sep 17 00:00:00 2001 From: Danilo Lutz Date: Wed, 19 Feb 2020 01:17:48 -0300 Subject: [PATCH 3/3] Fix: readme again --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fdfb306..548716a 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ## Install * Pathogen - * `git clone https://github.com/danilolutz/vim-docker-tools.git ~/.vim/bundle/vim-docker-tools` + * `git clone https://github.com/kevinhui/vim-docker-tools.git ~/.vim/bundle/vim-docker-tools` * Vim-plug * `Plug 'kevinhui/vim-docker-tools'` * NeoBundle