Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tmux e Vim

Tmux e Vim

Básico da utilizando de Tmux em conjunto com o editor de texto Vim para programação.

Tiago Martins

August 30, 2016
Tweet

More Decks by Tiago Martins

Other Decks in Programming

Transcript

  1. TMUX E VIM TMUX E VIM TORNANDO A INTERFACE GRÁFICA

    TORNANDO A INTERFACE GRÁFICA INÚTIL INÚTIL Tiago A. Martins 1 . 1
  2. HOTKEYS SEÇÕES prefix + $ Renomear seção prefix + d

    Desanexar seção prefix + ( Seção anterior prefix + ) Próxima seção 3 . 5
  3. HOTKEYS JANELAS prefix + c Nova janela prefix + ,

    Renomeia janela prefix + & Fecha janela prefix + w Mostra todas as janelas prefix + l Vai para a última janela ativa prefix + p Janela anterior prefix + n Próxima janela prefix + 0...9 Seleciona janela 3 . 6
  4. HOTKEYS PAINEIS prefix + ; Pula para último painel ativo

    prefix + % Divide verticalmente prefix + " Divide horizontalmente prefix + { Move o atual para a esquerda prefix + } Move o atual para a direita prefix + o Muda para próximo painel prefix + q Mostra os números dos paineis prefix + z Zoom no painel atual prefix + x Fecha o painel atual 3 . 7
  5. HOTKEYS COPY MODE prefix + [ Entra em copy mode

    Spacebar Inicia seleção Esc Limpa seleção Enter Copia seleção prefix + ] Cola conteúdo do buffer 0 :list-buffers 3 . 8
  6. BASH SCRIPT # Create new session tmux new-session -d -c

    'slides' -s pylestra # Create editor and server windows tmux new-window -a -n 'editor' -t pylestra -c 'slides' 'vim index.html' tmux new-window -a -n 'server' -t pylestra -c 'slides' 'npm start' # Attach to session tmux attach -t pylestra 4 . 2
  7. TMUXP pip install tmuxp session_name: 4-pane-split windows: - window_name: dev

    window layout: tiled shell_command_before: - cd ~/ panes: - shell_command: - cd /var/log - ls -al | grep \.log - pwd - pwd - pwd 4 . 3
  8. CTRL-B IS A PAIN! # Set Ctrl-a as the default

    prefix key combination # and unbind C-b to free it up set-option -g prefix C-a unbind-key C-b # Use send-prefix to pass C-a through to application bind-key C-a send-prefix 6 . 2
  9. VIM RULES!!! # Use vi-like status and mode keys set-option

    -g status-keys vi set-option -g mode-keys vi # Map vi-like movement keys as pane movement keys bind-key h select-pane -L bind-key j select-pane -D bind-key k select-pane -U bind-key l select-pane -R 6 . 4
  10. DISPATCH :Make Executa :make em foreground :Make! Executa :make em

    background :Dispatch + compiler + filename Executa :make com o compilador selecionado no arquivo desejado :Focus + compiler Modifica o compilador default temporariamente :Focus! Volta o compilador para o default https://github.com/tpope/vim-dispatch autocmd FileType python let b:dispatch = 'python -m doctest %' nnoremap <F9> :Dispatch<CR> 7 . 2
  11. PROJECTIONIST https://github.com/tpope/vim-surround { "*/tests.py": { "type": "tests", "alternate": "{}/models.py", "dispatch":

    "pytest {file}" }, "*/models.py": { "type": "models", "alternate": "{}/tests.py" }, "*/views.py": { "type": "views" }, "templates/*.html": { "type": "template" }, "README.md": { "type": "doc" } } 7 . 3
  12. FUGITIVE :Gdiff Vim diff do repositório :Gstatus Mostra git status

    (- para add / reset) :Gcommit git commit :Gblame git blame (Enter para editar o commit) :Gread git checkout -- filename para o buffer :Gwrite :w e git add https://github.com/tpope/vim-fugitive 7 . 4
  13. SURROUND yss + surround Adiciona a linha toda ys +

    motion + surround Adiciona com vim motions cs + motion + surround Muda com vim motions ds + motion + surround Apaga com vim motions S + surround Em modo visual https://github.com/tpope/vim-surround 7 . 5
  14. COMMENTARY gcc Comentar a linha gc + motion Comentar com

    vim motions :7,17Commentary Comentar intervalos :g/TODO/Commentary Comentar com regex https://github.com/tpope/vim-commentary 7 . 6