dot-files

所属分类:collect
开发工具:Vim Script
文件大小:0KB
下载次数:0
上传日期:2021-02-05 19:59:42
上 传 者sh-1993
说明:  :zap:文档良好的、以终端为中心的web开发人员的点文件。Neovim、Zsh、Tmux、Git等。,
(:zap: Well documented, terminal centric web developer s dot files. Neovim, Zsh, Tmux, Git, etc.,)

文件列表:
data/ (0, 2021-02-05)
data/cheatsheet.png (3380345, 2021-02-05)
data/cheatsheet2.pdf (434537, 2021-02-05)
data/screenshots/ (0, 2021-02-05)
data/screenshots/hybrid.png (278988, 2021-02-05)
data/screenshots/iceberg.png (278696, 2021-02-05)
data/screenshots/tender.png (278197, 2021-02-05)
git/ (0, 2021-02-05)
git/gitconfig (1862, 2021-02-05)
git/gitignore (714, 2021-02-05)
install.sh (7580, 2021-02-05)
js/ (0, 2021-02-05)
js/flowconfig (539, 2021-02-05)
js/npmrc (15, 2021-02-05)
js/tern-project (250, 2021-02-05)
linters/ (0, 2021-02-05)
linters/eslintrc.json (2244, 2021-02-05)
linters/haml-lint.yml (36, 2021-02-05)
linters/mdlrc (16, 2021-02-05)
linters/rubocop.yml (746, 2021-02-05)
neovim/ (0, 2021-02-05)
neovim/UltiSnips/ (0, 2021-02-05)
neovim/UltiSnips/all.snippets (623, 2021-02-05)
neovim/UltiSnips/elixir.snippets (282, 2021-02-05)
neovim/UltiSnips/elixir_definitions.snippets (457, 2021-02-05)
neovim/UltiSnips/elixir_docs.snippets (375, 2021-02-05)
neovim/UltiSnips/eruby.snippets (95, 2021-02-05)
neovim/UltiSnips/eruby_blocks.snippets (75, 2021-02-05)
neovim/UltiSnips/html_react.snippets (699, 2021-02-05)
neovim/UltiSnips/javascript.snippets (1060, 2021-02-05)
neovim/UltiSnips/javascript_es6.snippets (1161, 2021-02-05)
neovim/UltiSnips/javascript_flow.snippets (235, 2021-02-05)
neovim/UltiSnips/javascript_jsx.snippets (385, 2021-02-05)
neovim/UltiSnips/javascript_libraries_eslint.snippets (600, 2021-02-05)
neovim/UltiSnips/javascript_libraries_react.snippets (2877, 2021-02-05)
neovim/UltiSnips/javascript_libraries_redux.snippets (3261, 2021-02-05)
neovim/UltiSnips/javascript_libraries_saga.snippets (1177, 2021-02-05)
neovim/UltiSnips/rails_controllers.snippets (201, 2021-02-05)
... ...

# Well documented, terminal centric web developer's dot files Hey everybody. I am Martin, a software developer with an obsession for workflow improvement. Below I present the most interesting parts of my config files. **Feel free to be inspired**. | [Credits](https://github.com/martin-svk/dot-files/blob/master/#credits) | [License](https://github.com/martin-svk/dot-files/blob/master/#license) | ## What's included * [Neovim](https://github.com/martin-svk/dot-files/blob/master/#neovim) ([source](https://github.com/martin-svk/dot-files/blob/master/./neovim/init.vim)) * [ZSH](https://github.com/martin-svk/dot-files/blob/master/#zsh) ([source](https://github.com/martin-svk/dot-files/blob/master/./shell/zshrc)) * [Tmux](https://github.com/martin-svk/dot-files/blob/master/#tmux) ([source](https://github.com/martin-svk/dot-files/blob/master/./tmux/tmux.conf)) * [Git](https://github.com/martin-svk/dot-files/blob/master/#git) ([source](https://github.com/martin-svk/dot-files/blob/master/./git/gitconfig)) * [Xterm](https://github.com/martin-svk/dot-files/blob/master/#xterm) ([source](https://github.com/martin-svk/dot-files/blob/master/./shell/Xresources)) * [Ruby utilities (pry, gem, IRB)](https://github.com/martin-svk/dot-files/blob/master/#pry-gem-irb) * [Other utilities (Ag search, Devilspie2)](https://github.com/martin-svk/dot-files/blob/master/#ag-devilspie2) ## Neovim I am using [Neovim](https://github.com/martin-svk/dot-files/blob/master/http://neovim.org/) which is a **Vim** fork focused on maintainability. Below are the most interesting parts of my Neovim configuration. ### Show me the end result first Here you go. ![Neovim + Tender](https://github.com/martin-svk/dot-files/blob/master/./data/screenshots/tender.png) Want more? Scroll down to the appropriate [section](https://github.com/martin-svk/dot-files/blob/master/#screenshots-and-cheatsheets). ### Plugins I use the excellent [vim-plug](https://github.com/martin-svk/dot-files/blob/master/https://github.com/junegunn/vim-plug) package manager. It supports parallel fetching, lazy loading, after install hooks, etc. You should consider using it :) And which plugins I use? Currently I use about **75** plugins. Some of the most interesting are: * [Neomake](https://github.com/martin-svk/dot-files/blob/master/https://github.com/benekastah/neomake) - Linter integration (Syntastic alternative) with asynchronous support. * [Unite](https://github.com/martin-svk/dot-files/blob/master/https://github.com/Shougo/unite.vim) - Search and display information from arbitrary sources. * [Deoplete](https://github.com/martin-svk/dot-files/blob/master/https://github.com/Shougo/deoplete.nvim) - Autocomplete with Neovim asynchronous support. * [Lightline](https://github.com/martin-svk/dot-files/blob/master/https://github.com/itchyny/lightline.vim) - Lightweight but extensible and configurable status line. * [Lexima](https://github.com/martin-svk/dot-files/blob/master/https://github.com/cohama/lexima.vim) - Auto-closing (,",' and some language constructs (ruby blocks). Dot repeat supported. For a complete list, look [here](https://github.com/martin-svk/dot-files/blob/master/./neovim/init.vim#L24). ### Utility scripts In the code snippets below I ofter call `utils#xxx()` functions. Those are just simple multiple lines long vimscript functions (often inspired by other people). You can find them [here](https://github.com/martin-svk/dot-files/blob/master/./neovim/autoload/utils.vim). ### Vim defaults overriding (improving) ```VimL " Easier window switching nmap :call utils#intelligentCycling() nnoremap h nnoremap j nnoremap k nnoremap l " Visual linewise up and down by default (and use gj gk to go quicker) nnoremap j gj nnoremap k gk nnoremap gj 5j nnoremap gk 5k vnoremap j gj vnoremap k gk vnoremap gj 5j vnoremap gk 5k " When jump to next match also center screen nnoremap n nzz nnoremap N Nzz vnoremap n nzz vnoremap N Nzz " Same when moving up and down nnoremap zz nnoremap zz nnoremap zz nnoremap zz vnoremap zz vnoremap zz vnoremap zz vnoremap zz " Remap H and L (top, bottom of screen to left and right end of line) nnoremap H ^ nnoremap L $ vnoremap H ^ vnoremap L g_ " More logical Y (default was alias for yy) nnoremap Y y$ " Quick replay q macro nnoremap Q @q " Don't yank to default register when changing something nnoremap c "xc xnoremap c "xc " After block yank and paste, move cursor to the end of operated text " Also, don't copy over-pasted text in visual mode vnoremap y y`] vnoremap p "_dP`] nnoremap p p`] " Use camel-case motion instead of default motions map w CamelCaseMotion_w map b CamelCaseMotion_b map e CamelCaseMotion_e map ge CamelCaseMotion_ge sunmap w sunmap b sunmap e sunmap ge " Fix the cw at the end of line bug default Vim has special treatment (:help cw) nmap cw ce nmap dw de " Uppercase word in insert mode inoremap mzgUiw`za " Matching brackets with TAB (using matchit) (Breaks the jump) map % silent! unmap [% silent! unmap ]% " Don't cancel visual select when shifting xnoremap < >gv " Cancel terminal mode with ,escape if has('nvim') tnoremap tnoremap , endif " Stay down after creating fold vnoremap zf mzzf`zzz ``` ### Common tasks ```VimL " Quick save and close buffer nnoremap ,w :w nnoremap ,c :Sayonara! nnoremap ,q :Sayonara " Yank and paste from clipboard nnoremap ,y "+y vnoremap ,y "+y nnoremap ,yy "+yy nnoremap ,p "+p " Move visual block vnoremap J :m '>+1gv=gv vnoremap K :m '<-2gv=gv " Ctags navigation (:tselect to select from menu) nnoremap ]t :tn nnoremap [t :tp " Quick-fix window navigation nnoremap ]q :cnext nnoremap [q :cprevious " Location list navigation nnoremap ]l :lnext nnoremap [l :lprevious " Error mnemonic (Neomake uses location list) nnoremap ]e :lnext nnoremap [e :lprevious " Reselect last-pasted text nnoremap gp `[v`] " Keep the cursor in place while joining lines nnoremap J mzJ`z " Split line (sister to Join lines) S is covered by cc. nnoremap S mzi`z " Easier fold toggling nnoremap ,z za " Start substitute on current word under the cursor nnoremap ,s :%s///gc ``` ### Buffer management ```VimL " Intelligent windows resizing using Ctrl + arrow keys nnoremap :call utils#intelligentVerticalResize('right') nnoremap :call utils#intelligentVerticalResize('left') nnoremap :resize +1 nnoremap :resize -1 " Buffers navigation and management nnoremap + :bn nnoremap _ :bp ``` ### Autocomplete (Deoplete + Ctags) ```VimL let g:deoplete#enable_at_startup=1 let g:deoplete#auto_completion_start_length=2 let g:deoplete#sources={} let g:deoplete#sources._ = ['buffer', 'file', 'ultisnips'] let g:deoplete#sources.ruby = ['buffer', 'member', 'file', 'ultisnips'] let g:deoplete#sources.vim = ['buffer', 'member', 'file', 'ultisnips'] let g:deoplete#sources.css = ['buffer', 'member', 'file', 'omni', 'ultisnips'] let g:deoplete#sources.scss = ['buffer', 'member', 'file', 'omni', 'ultisnips'] " Insert or select next match inoremap utils#tabComplete() " Manually trigger tag autocomplete inoremap utils#manualTagComplete() " , : close popup and delete previous char inoremap deolete#mappings#smart_close_popup()."\" inoremap deoplete#mappings#smart_close_popup()."\" ``` ### Browser and fuzzy searcher for multiple sources ([Unite](https://github.com/martin-svk/dot-files/blob/master/https://github.com/Shougo/unite.vim)) ```VimL " Matcher settings call unite#filters#matcher_default#use(['matcher_fuzzy', 'matcher_hide_current_file']) call unite#filters#sorter_default#use(['sorter_rank']) " Use Ag if available if executable('ag') let g:unite_source_grep_command='ag' let g:unite_source_grep_default_opts='--nocolor --line-numbers --nogroup -S -C0' let g:unite_source_grep_recursive_opt='' " Set rec source command let g:unite_source_rec_async_command = ['ag', '--follow', '--nocolor', '--nogroup', '--hidden', '-g', ''] endif " Custom profile call unite#custom#profile('default', 'context', { \ 'prompt': ' ', \ 'winheight': 15, \ }) " Add syntax highlighting let g:unite_source_line_enable_highlight=1 " Don't override status line let g:unite_force_overwrite_statusline=0 ``` #### Unite buffer mappings ```VimL " Custom mappings for the unite buffer autocmd FileType unite call s:unite_settings() function! s:unite_settings() " Enable navigation with and in insert mode imap (unite_select_next_line) imap (unite_select_previous_line) " Runs 'splits' action by and imap unite#do_action('split') imap unite#do_action('vsplit') " Exit with escape nmap (unite_exit) " Mark candidates vmap m (unite_toggle_mark_selected_candidates) nmap m (unite_toggle_mark_current_candidate) endfunction ``` ### Improved status line ([Lightline](https://github.com/martin-svk/dot-files/blob/master/https://github.com/itchyny/lightline.vim)) ```VimL let g:lightline = { \ 'colorscheme': 'powerline', \ 'tab': { \ 'active': [ 'filename' ], \ 'inactive': [ 'filename' ] \ }, \ 'active': { \ 'left': [ [ 'mode', 'paste' ], [ 'readonly', 'filename' ] ], \ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'filetype', 'fileencoding', 'fileformat' ] ] \ }, \ 'component': { \ 'readonly': '%{&filetype=="help"?"HELP":&readonly?"RO":""}' \ }, \ 'component_function': { \ 'mode': 'utils#lightLineMode', \ 'filename': 'utils#lightLineFilename', \ 'filetype': 'utils#lightLineFiletype', \ 'fileformat': 'utils#lightLineFileformat', \ 'fileencoding': 'utils#lightLineFileencoding' \ }, \ 'component_visible_condition': { \ 'readonly': '(&readonly)' \ }, \ 'separator': { 'left': '', 'right': '' }, \ 'subseparator': { 'left': '', 'right': '' } \ } ``` ### Snippets support ([UltiSnips](https://github.com/martin-svk/dot-files/blob/master/https://github.com/SirVer/ultisnips)) ```VimL " Disable built-in to be able to go backward inoremap let g:UltiSnipsExpandTrigger='' let g:UltiSnipsListSnippets='' let g:UltiSnipsJumpForwardTrigger='' let g:UltiSnipsJumpBackwardTrigger='' ``` ### Color settings based on time ```viml " Syntax highlighting syntax on " Color scheme based on time if strftime("%H") < 16 let g:rehash256 = 1 colorscheme molokai else colorscheme jellybeans endif " Highlight VCS conflict markers match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' " Highlight term cursor differently highlight TermCursor ctermfg=green guifg=green " Remove underline in folded lines hi! Folded term=NONE cterm=NONE gui=NONE ctermbg=NONE " List chars highlighting highlight NonText ctermfg=235 guifg=gray highlight SpecialKey ctermfg=235 guifg=gray " Link highlight groups to improve buffer tab line colors hi! link BufTabLineCurrent Identifier hi! link BufTabLineActive Comment hi! link BufTabLineHidden Comment hi! link BufTabLineFill Comment ``` ### Screenshots and Cheatsheets [Iceberg](https://github.com/martin-svk/dot-files/blob/master/./data/screenshots/iceberg.png) [Hybrid](https://github.com/martin-svk/dot-files/blob/master/./data/screenshots/hybrid.png) [Image cheatsheet](https://github.com/martin-svk/dot-files/blob/master/./data/cheatsheet.png) [PDF cheatsheet](https://github.com/martin-svk/dot-files/blob/master/./data/cheatsheet2.pdf) ## Zsh My shell interpreter of choice. Here are some options to improve the behavior to my taste. ```zsh # Disable control flow ( / ) stty stop '' -ixoff -ixon # Set spelling correction setopt correct # Don't raise errors when regex nomatch fires unsetopt nomatch ``` I am also using the excellent [oh-my-zsh](https://github.com/martin-svk/dot-files/blob/master/https://github.com/robbyrussell/oh-my-zsh) framework. ```zsh # Path to your oh-my-zsh installation. export ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. ZSH_THEME="martinus" # Disable auto title setting DISABLE_AUTO_TITLE="true" # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) plugins=(adb bgnotify bower bundler common-aliases docker extract gem gitfast gulp heroku httpie jsontools meteor mix npm rails rbenv redis-cli rsync tmux tmuxinator vagrant zsh-syntax-highlighting) source $ZSH/oh-my-zsh.sh source $ZSH/plugins/history-substring-search/history-substring-search.zsh # History substring search plugin binding bindkey '^[[A' history-substring-search-up bindkey '^[[B' history-substring-search-down ``` ## Tmux I am a heavy user of tmux. I am using the [tpm](https://github.com/martin-svk/dot-files/blob/master/https://github.com/tmux-plugins/tpm) package manager and mainly it's [tmux resurrect](https://github.com/martin-svk/dot-files/blob/master/https://github.com/tmux-plugins/tmux-resurrect) plugin which allows me to persist sessions on the disk. I am also using the [tmuxinator](https://github.com/martin-svk/dot-files/blob/master/https://github.com/tmuxinator/tmuxinator) gem to quickly bootstrap new tmux sessions. Below are the most interesting settings in my tmux config file: ### Settings ```tmux # Unset ruby version so it respects .ruby-version files set-environment -gu RBENV_VERSION # UTF-8 settings set -g status-utf8 on set -g utf8 on # Fastest command sequences (http://superuser.com/a/252717/65504) set -s escape-time 0 # For nice colors set -g default-terminal "screen-256color" # XTerm compatibility set -g xterm-keys on # Vi keys in copy mode set -g mode-keys vi # History boost set -g history-limit 50000 # Enable mouse set -g mode-mouse on set -g mouse-select-pane on set -g mouse-resize-pane on set -g mouse-select-window on # Emacs key bindings in command prompt (prefix + :) are better than vi keys, even for vim users set -g status-keys emacs # Focus events enabled for terminals that support them set -g focus-events on # Super useful when using "grouped sessions" and multi-monitor setup setw -g aggressive-resize on # Messages are displayed for 3 seconds set -g display-time 3000 ``` ### Key bindings ```tmux # Backtick as Prefix unbind C-b set -g prefix ` bind-key ` send-prefix # Reload the file with Prefix r bind R source-file ~/.tmux.conf \; display "Sourced tmux.conf" # Next and prev window like in vim bind -r - previous-window bind -r = next-window # New windows and panes in the same dir bind-key n new-window -c "#{pane_current_path}" bind-key i split-window -h -c "#{pane_current_path}" bind-key v split-window -c "#{pane_current_path}" # Pane switching bind-key h select-pane -L bind-key j select-pane -D bind-key k select-pane -U bind-key l select-pane -R bind-key \ select-pane -l # Resize panes with arrows bind-key -r Left resize-pane -L 1 bind-key -r Down resize-pane -D 1 bind-key -r Up resize-pane -U 1 bind-key -r Right resize-pane -R 1 # r to rename window bind-key r command-prompt 'rename-window %%' # p to paste buffer unbind p bind p paste-buffer # P to choose which buffer to paste bind P choose-buffer ``` ### Plugins ```zsh # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-yank' # yanking helpers set -g @plugin 'tmux-plugins/tmux-sessionist' # session helpers prefix + C (new session) set -g @plugin 'tmux-plugins/tmux-resurrect' # prefix + save, restore set -g @plugin 'tmux-plugins/tmux-battery' # Batter percentage set -g @plugin 'tmux-plugins/tmux-online-status' # Online status # Initialize plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm' ``` ## Git What about my git config? Maybe some useful aliases: ```git [alias] a = add aa = add --all di = diff ds = diff --staged dt = difftool --no-prompt ci = commit --verbose amend = commit --amend --verbose co = checkout pl = pull ps = push pom = push origin master pod = push origin develop rb = rebase -i HEAD~10 st = status -sb br = branch lo = log --oneline -n 15 lg = log --pretty=format:'%h | %cd | %an | %s' -n 15 ls = log --stat -n 5 lol = log --oneline --graph --all --decorate g1 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%cr)%C(reset) %C(white)%s%C(reset) %C(bold white)— %cn%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative g2 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%cD%C(reset) %C(bold green)(%cr)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %cn%C(reset)' --abbrev-commit wc = whatchanged -p --abbrev-commit --pretty=medium unstage = reset HEAD -- edit = "!nvim `git ls-files -m`" ``` ## Xterm My terminal emulator of choice. Below are some interesting settings I use: ```xdefaults ! Unicode support xterm*utf8: 1 ! Color support xterm*customization: -color xterm*termName: xterm-256color ! Font settings xterm*faceName: Droid Sans Mono for Powerline:Bold xterm*faceSize: 9 xterm*allowBoldFonts: false ! For inclusion of all necessary environment variables xterm*loginShell: true ! Scrollback setting xterm*savelines: 10000 ! Disable right scrollbar xterm*ScrollBar: false ! Stop output to terminal from jumping down to bottom of scroll again xterm*scrollTtyOutput: false ! Save selections to clipboard xterm*selectToClipboard: true ``` ## Pry, Gem, IRB Don't install RI docs when installing gems (put into your gemrc): ```bash gem: --no-ri --no-rdoc ``` Use editor to edit bigger blocks of code when in pry (put into your pryrc): ```bash # === EDITOR === Pry.config.editor = 'nvim' ``` Require Rubygems in *irbrc* to have access while in IRB session (I recommend using Pry): ```ruby require 'rubygems' ``` ## Ag, Devilspie2 [Ag](https://github.com/martin-svk/dot-files/blob/master/http://geoff.greer.fm/ag/) is a popular and blazingly fast find on steroids optimized for developers. I recommend to create *agignore* to specify extra path to ignore. While Ag is pretty intelligent most of things are already ignored. ```bash *.log tmp/* ``` [Devilspie2](https://github.com/martin-svk/dot-files/blob/master/http://www.gusnan.se/devilspie2/) is a window matching utility, allowing the user to perform scripted actions on windows as they are created. I use it mainly to move application to their reserved workspace and to make them go full screen automatically. Below is an example of such script: ```lua -- XTerm if (get_application_name()=="xterm") then set_window_workspace(2); maximize(); end ``` # Credits Very big portion of these configuration files was inspired and often even copied from other people, plugin authors, blog writers, etc. I want to say **Thank You** to all of them. Especially, I want to mention these guys: * [tpope](https://github.com/martin-svk/dot-files/blob/master/https://github.com/tpope) * [garybernhardt](https://github.com/martin-svk/dot-files/blob/master/https://github.com/garybernhardt) * [Shougo](https://github.com/martin-svk/dot-files/blob/master/https://github.com/Shougo) For their contribution to Vim and Neovim ecosystem. Speaking of [Neovim](https://github.com/martin-svk/dot-files/blob/master/https://github.com/neovim/neovim), the whole [team](https://github.com/martin-svk/dot-files/blob/master/https://github.com/neovim/neovim/graphs/contributors) should be mentioned for their great work. # License Well documented, terminal centric web developer's dot files. Copyright (C) Martin Toma Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

近期下载者

相关文件


收藏者