{"id":23284228,"url":"https://github.com/agilecreativity/tmux-starter","last_synced_at":"2025-04-06T15:15:16.301Z","repository":{"id":22330255,"uuid":"25665753","full_name":"agilecreativity/tmux-starter","owner":"agilecreativity","description":"Simple shell script to automate the provision of tmux session","archived":false,"fork":false,"pushed_at":"2015-02-25T23:25:27.000Z","size":264,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T05:01:58.696Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agilecreativity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-24T01:25:27.000Z","updated_at":"2021-02-23T16:05:21.000Z","dependencies_parsed_at":"2022-08-21T02:30:41.765Z","dependency_job_id":null,"html_url":"https://github.com/agilecreativity/tmux-starter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agilecreativity%2Ftmux-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agilecreativity%2Ftmux-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agilecreativity%2Ftmux-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agilecreativity%2Ftmux-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agilecreativity","download_url":"https://codeload.github.com/agilecreativity/tmux-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247500476,"owners_count":20948880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-20T01:38:51.710Z","updated_at":"2025-04-06T15:15:16.253Z","avatar_url":"https://github.com/agilecreativity.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## tmux-starter\n\nThe simple shell script that automate the tmux sessions the way I like it.\nSee [this blog post](http://choomnuan.com/blog/2015/02/21/how-to-automate-your-tmux-sessions-using-simple-shell-script/)\nfor more detail.\n\n### Usage\n\nPlease read the script and adjust the folowing information for your use.\nThe script is very small and is very easy to customize to your specific need.\n\nTLDR;\n\nAdjust the command in the following location to your project and just run the script.\n\n```sh\n# Note: main program {{{\ng_session_name=$1\n# Use the default value if not specified\n: ${g_session_name:=\"rails-dev\"}\ng_session_count=0\n\nkill_process 'sidekiq'\nkill_process 'bin/rails'\nkill_process 'redis-server'\nset_base_environment $g_session_name\n\nkill-session $g_session_name\n\nPROJECT_DIR='~/codes/exec-io/envisage'\n\ncreate-session 'redis-server' 'cd $PROJECT_DIR; redis-server'\nadd-window 'sidekiq'          'cd $PROJECT_DIR; bundle exec sidekiq'\nadd-window 'rails-console'    'cd $PROJECT_DIR; rails console'\nadd-window 'rails-server'     'cd $PROJECT_DIR; rails server'\nadd-window 'guard'            'cd $PROJECT_DIR; bundle exec guard'\nadd-window 'editor'           'cd $PROJECT_DIR; vim'\n\nsession-info\nattach-session\n## }}}\n```\n\n### Links and resources that I found/used while implementing this script!\n\n- http://unix.stackexchange.com/questions/14300/moving-tmux-window-to-pane\n- http://tldp.org/LDP/Bash-Beginners-Guide/html/\n- http://askubuntu.com/questions/385528/how-to-increment-a-variable-in-bash\n- http://stackoverflow.com/questions/5014632/how-can-i-parse-a-yaml-file-from-a-linux-shell-script\n- http://www.cyberciti.biz/tips/howto-setting-default-values-for-shell-variables.html\n- [tmuxinator][] - Ruby gem that make provision tmux easier (require ruby)\n- [Good introduction to Bash](http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html)\n- [http://stackoverflow.com/questions/3432536/create-session-if-none-exists](http://stackoverflow.com/questions/3432536/create-session-if-none-exists)\n- http://robots.thoughtbot.com/a-tmux-crash-course\n- http://code.tutsplus.com/tutorials/test-driving-shell-scripts--net-31487\n- https://code.google.com/p/shunit2/downloads/list\n- https://code.google.com/p/shunit2/wiki/GeneralFaq\n- [Tmux Crash Course](http://robots.thoughtbot.com/a-tmux-crash-course)\n- http://superuser.com/questions/492266/run-or-send-a-command-to-a-tmux-pane-in-a-running-tmux-session\n\n### Useful tmux commands\n\n```\n# Sessions\ntmux switch -t session_name\ntmux attach -t session_name\ntmux list-sessions (tmux ls)\ntmux detach (prefix + d)\n\n# Windows\ntmux new-window (prefix + c)\ntmux select-window -t :0-9 (prefix + 0-9) [note: depend on your pane-base-index]\ntmux rename-window (prefix + ,)\n\n# Panes\ntmux split-window (prefix + \")\ntmux split-window -h (prefix + %)\ntmux split-pane -[UDLR] (prefix + { or })\ntmux select-pane -[UDLR]\ntmux select-pane -t :.+\n\n# Misc commands\ntmux list-keys\ntmux list-commands\ntmux info\ntmux source-file ~/.tmux.conf\n\n# Must haves\n## remap prefix to Control + a\nset -g prefix C-a\nunbind C-b\nbind C-a send-prefix\n\n## force a reload of a config file\nunbind r\nbind r source-file ~/.tmux.conf\n\n## Quick pane cycling (i use\nunbind ^A\nbind ^A select-pand -t :.+\n```\n\n### Misc command that you may like to know about tmux\n\n```\ntmux start-server\\; has-sesstion -t {{name}} 2\u003e/dev/null\ntmux new-session -d -s {{name}} -n {{windows.first.name}}\n\n# if tmux version \u003c 1.7\ntmux set-option -t {{name}} default-path {{root}} 1\u003e/dev/null\n\n# if tmux version \u003e= 1.7\ntmux set-option -t {{name}} -c           {{root}} 1\u003e/dev/null\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagilecreativity%2Ftmux-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagilecreativity%2Ftmux-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagilecreativity%2Ftmux-starter/lists"}