Page 3 of 4

Re: tips and tricks for everything but emacs

Posted: Sat Jul 18, 2015 5:05 pm
by stark
Use vim as your $PAGER:
https://github.com/rkitover/vimpager

Vimpager also comes with vimcat:
https://github.com/ofavre/vimcat

Re: tips and tricks for everything but emacs

Posted: Sat Jul 18, 2015 11:40 pm
by simgin
^ Thank you for the share starck, but I did not know that you used vim, because your profile says geany!

Re: tips and tricks for everything but emacs

Posted: Sun Jul 19, 2015 9:25 am
by nova
Nice! Thanks for sharing Stark.

Re: tips and tricks for everything but emacs

Posted: Sun Jul 19, 2015 12:54 pm
by stark
@simgin I use geany's terminal to open emacs in noX mode and then use emacs's ansi-term to use vim ;)

Re: tips and tricks for everything but emacs

Posted: Sun Jul 19, 2015 3:19 pm
by simgin
^ wow mate :D
I know some people also use Geany as a poject overview. Hmm, maybe I should try that.

Re: tips and tricks for everything but emacs

Posted: Thu Jul 23, 2015 2:01 pm
by kexolino
Another one for vim: sessions. I was wondering how to do this after trying Sublime Text, which just continues where you left off. There are plugins which enhance this functionality, but the basic vim way is good enough.

If you are working with multiple files, say you have your window split into two, a few tabs etc, then you can do a :mks (or :mksession) session_name.vim - this will save all the stuff like which files were open and how, any settings and so on. Then, you can open it with vim -S session_name.vim or open vim and do a :source path/to/session_name.vim.

The way I do it now is saving the session files to ~/.sessions, start up vim by itself and source the one I want.

Re: tips and tricks for everything but emacs

Posted: Sat Jan 30, 2016 4:37 pm
by pidsley
I was irritated by the (R) and (TM) in the cpu output of env-info, so I removed them.

Change the awk line in the print-cpu function to remove the (R) and (TM):

Code: Select all

cpu=$(awk -F': ' '/model name/ {gsub("\\(R\\)",""); gsub("\\(TM\\)",""); print $2; exit}' /proc/cpuinfo)

Re: tips and tricks for everything but emacs

Posted: Sun Jan 31, 2016 6:45 am
by rhowaldt
hahaha, great :D

Re: tips and tricks for everything but emacs

Posted: Fri Jun 17, 2016 2:46 pm
by stark
Recently I've been browsing Vimcasts.

If you prefer to watch stuff offline then hopefully you have youtube-dl installed then, you can use this script to get all the 68 episodes !

curl -# http://ix.io/TQx | sh

Code: Select all

#!/bin/sh

_print_url()
{
	cat << EOF
http://vimcasts.org/episodes/ultisnips-visual-placeholder/
http://vimcasts.org/episodes/ultisnips-python-interpolation/
http://vimcasts.org/episodes/meet-ultisnips/
http://vimcasts.org/episodes/swapping-two-regions-of-text-with-exchange-vim/
http://vimcasts.org/episodes/using-external-filter-commands-to-reformat-html/
http://vimcasts.org/episodes/operating-on-search-matches-using-gn/
http://vimcasts.org/episodes/creating-mappings-that-accept-a-count/
http://vimcasts.org/episodes/creating-repeatable-mappings-with-repeat-vim/
http://vimcasts.org/episodes/comparing-buffers-with-vimdiff/
http://vimcasts.org/episodes/using-vims-paste-mode-with-the-system-paste-command/
http://vimcasts.org/episodes/accessing-the-system-clipboard-from-vim/
http://vimcasts.org/episodes/evaluating-scripts-with-vims-expression-register/
http://vimcasts.org/episodes/simple-calculations-with-vims-expression-register/
http://vimcasts.org/episodes/pasting-from-insert-mode/
http://vimcasts.org/episodes/pasting-from-visual-mode/
http://vimcasts.org/episodes/using-vims-named-registers/
http://vimcasts.org/episodes/meet-the-yank-register/
http://vimcasts.org/episodes/simple-operations-using-the-default-register/
http://vimcasts.org/episodes/an-introduction-to-vspec/
http://vimcasts.org/episodes/enhanced-abbreviations-with-abolish/
http://vimcasts.org/episodes/supercharged-substitution-with-subvert/
http://vimcasts.org/episodes/smart-search-with-subvert/
http://vimcasts.org/episodes/search-for-the-selected-text/
http://vimcasts.org/episodes/project-wide-find-and-replace/
http://vimcasts.org/episodes/search-multiple-files-with-vimgrep/
http://vimcasts.org/episodes/using-argdo-to-change-multiple-files/
http://vimcasts.org/episodes/populating-the-arglist/
http://vimcasts.org/episodes/meet-the-arglist/
http://vimcasts.org/episodes/long-range-line-duplication/
http://vimcasts.org/episodes/profiling-vimscript-performance/
http://vimcasts.org/episodes/writing-a-custom-fold-expression/
http://vimcasts.org/episodes/how-to-fold/
http://vimcasts.org/episodes/vimgolf-prime-numbers/
http://vimcasts.org/episodes/fugitive-vim-exploring-the-history-of-a-git-repository/
http://vimcasts.org/episodes/fugitive-vim-browsing-the-git-object-database/
http://vimcasts.org/episodes/fugitive-vim-resolving-merge-conflicts-with-vimdiff/
http://vimcasts.org/episodes/fugitive-vim-working-with-the-git-index/
http://vimcasts.org/episodes/fugitive-vim---a-complement-to-command-line-git/
http://vimcasts.org/episodes/undo-branching-and-gundo-vim/
http://vimcasts.org/episodes/aligning-text-with-tabular-vim/
http://vimcasts.org/episodes/refining-search-patterns-with-the-command-line-window/
http://vimcasts.org/episodes/synchronizing-plugins-with-git-submodules-and-pathogen/
http://vimcasts.org/episodes/bubbling-text/
http://vimcasts.org/episodes/creating-colorschemes-for-vim/
http://vimcasts.org/episodes/updating-your-vimrc-file-on-the-fly/
http://vimcasts.org/episodes/converting-haml-to-erb-with-vim-macros/
http://vimcasts.org/episodes/selecting-columns-with-visual-block-mode/
http://vimcasts.org/episodes/converting-markdown-to-structured-html-with-a-macro/
http://vimcasts.org/episodes/running-vim-within-irb/
http://vimcasts.org/episodes/spell-checking/
http://vimcasts.org/episodes/formatting-text-with-par/
http://vimcasts.org/episodes/hard-wrapping-text/
http://vimcasts.org/episodes/soft-wrapping-text/
http://vimcasts.org/episodes/the-file-explorer/
http://vimcasts.org/episodes/the-edit-command/
http://vimcasts.org/episodes/cleaning-up-with-vim/
http://vimcasts.org/episodes/modal-editing-undo-redo-and-repeat/
http://vimcasts.org/episodes/using-the-changelist-and-jumplist/
http://vimcasts.org/episodes/creating-the-vimcasts-logo-as-ascii-art/
http://vimcasts.org/episodes/how-to-use-tabs/
http://vimcasts.org/episodes/working-with-tabs/
http://vimcasts.org/episodes/working-with-windows/
http://vimcasts.org/episodes/working-with-buffers/
http://vimcasts.org/episodes/indentation-commands/
http://vimcasts.org/episodes/tidying-whitespace/
http://vimcasts.org/episodes/whitespace-preferences-and-filetypes/
http://vimcasts.org/episodes/tabs-and-spaces/
http://vimcasts.org/episodes/show-invisibles/
EOF
}

_get()
{
	while read URL; do
		youtube-dl "$URL"
	done
}

_print_url | _get

exit 0

Re: tips and tricks for everything but emacs

Posted: Sat Jun 18, 2016 3:01 pm
by ivanovnegro
Wow.

Re: tips and tricks for everything but emacs

Posted: Sun Jun 19, 2016 1:00 pm
by ChefIronBelly
^ yes and thanks stark

Re: tips and tricks for everything but emacs

Posted: Wed Jun 22, 2016 1:57 pm
by arnold
Thank you Stark. This inspired me to download all the Skeptoid episodes.

Re: tips and tricks for everything but emacs

Posted: Wed Aug 10, 2016 11:56 am
by wuxmedia
http://www.compciv.org/topics/bash/loops/
is just really good, pretty much all the useful ways to loop stuff in bash, with mainly examples.

and illustrates, you can hit return after do and if's and run it like that.

Re: tips and tricks for everything but emacs

Posted: Wed Aug 10, 2016 3:10 pm
by pidsley
^ Thanks wux. Another way to loop a set of numbers without using "seq":

Code: Select all

for x in {2..15}; do
    echo $x
done

Re: tips and tricks for everything but emacs

Posted: Fri Sep 16, 2016 7:13 am
by wuxmedia
So, I accidentally found this the other day - in 'less' - hit 'v' and it opens your $EDITOR with the current file.
I got very confused when I was suddenly editing a log file...

Re: tips and tricks for everything but emacs

Posted: Fri Sep 16, 2016 9:33 am
by Snap
^ That's a great one! Thanks, wux.

Re: tips and tricks for everything but emacs

Posted: Tue Nov 22, 2016 1:01 pm
by franksinistra
search last 500 entry at commandlinefu.com, and display each entry voted 5 or more to stdout.

Code: Select all

curl -s www.commandlinefu.com/commands/browse/sort-by-date/json/{0..500..25} | \
    jq -r '.[]|select(.votes|tonumber>=5)|"# "+.summary+"\n"+.command+"\n"'

Re: tips and tricks for everything but emacs

Posted: Tue Nov 22, 2016 7:50 pm
by wuxmedia
did you find that one on commandline fu? META

Re: tips and tricks for everything but emacs

Posted: Tue Nov 22, 2016 8:29 pm
by franksinistra
^ on reddit actually, earlier this year. Forgot the thread and the original author. :P

Re: tips and tricks for everything but emacs

Posted: Fri Dec 08, 2017 6:58 pm
by franksinistra
I'm feeling adventurous, tried nvim and its bag of goods (They even got something like magit, wow and helm/cousel like interface in denite) and tried several autocompletion plugins.

Hit a roadblock in trying to make delimitMate and clang_complete (under deoplete) to play nice with each other, this is my solution:

Code: Select all

" Will put a nice <CR> if within an empty pair (of '{}' for example) after completion. 
" like this:
" {
"         | (the cursor)
" }
" if you're not using deoplete:
let g:clang_restore_cr_imap =
	\ 'imap <silent><CR> (delimitMate#WithinEmptyPair() ? "\<C-R>delimitMate#ExpandReturn()\<CR>" : "\<CR>")'
" if you do:
inoremap <silent><expr><CR> pumvisible() ?  deoplete#close_popup()
	\ : (delimitMate#WithinEmptyPair() ? "\<C-R>=delimitMate#ExpandReturn()\<CR>" : "\<CR>")
Edit: fuck, forgot the first then clause