devdocs lookup
This commit is contained in:
		
							parent
							
								
									38c3127004
								
							
						
					
					
						commit
						298af8af0a
					
				
							
								
								
									
										20
									
								
								vimrc
								
								
								
								
							
							
						
						
									
										20
									
								
								vimrc
								
								
								
								
							| 
						 | 
					@ -517,7 +517,27 @@ if !exists('*RangerExplorer')
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					" devdocs DD
 | 
				
			||||||
 | 
					" https://gist.github.com/romainl/8d3b73428b4366f75a19be2dad2f0987#file-devdocs-vim
 | 
				
			||||||
 | 
					function! s:Get_env() abort
 | 
				
			||||||
 | 
					    if has('win64') || has('win32') || has('win16')
 | 
				
			||||||
 | 
					        return 'WINDOWS'
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        return toupper(substitute(system('uname'), '\n', '', ''))
 | 
				
			||||||
 | 
					    endif
 | 
				
			||||||
 | 
					endfunction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					" What command to use on what system
 | 
				
			||||||
 | 
					let s:cmds = {"DARWIN": "open", "LINUX": "qutebrowser", "WINDOWS": "start"}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					" Build the URL stub
 | 
				
			||||||
 | 
					let s:stub = s:cmds[<SID>Get_env()] . " 'http://devdocs.io/?q="
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					command! -nargs=* DD silent! call system(len(split(<q-args>, ' ')) == 0 ?
 | 
				
			||||||
 | 
					            \ s:stub . &ft . ' ' . expand('<cword>') . "'" : len(split(<q-args>, ' ')) == 1 ?
 | 
				
			||||||
 | 
					            \ s:stub . &ft . ' ' . <q-args> . "'" : s:stub . <q-args> . "'")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					nnoremap <leader>dd :DD<CR>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" ze end
 | 
					" ze end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue