tips and tricks for everything but emacs

Forum rules
Share your brain ;)
User avatar
stark
MILF
Posts: 521
Joined: Sat Sep 27, 2014 6:38 pm
Location: Arpanet
Contact:

Re: tips and tricks for everything but emacs

Unread post by stark » Sat Jul 18, 2015 5:05 pm

Use vim as your $PAGER:
https://github.com/rkitover/vimpager

Vimpager also comes with vimcat:
https://github.com/ofavre/vimcat
If you can do it go ahead and do it, if you can't do it then don't even criticize it. - gingerdesu

User avatar
simgin
Meme Fodder
Posts: 1167
Joined: Sun Jan 06, 2013 12:07 am
Location: Bradford-on-Avon, UK

Re: tips and tricks for everything but emacs

Unread post by simgin » Sat Jul 18, 2015 11:40 pm

^ Thank you for the share starck, but I did not know that you used vim, because your profile says geany!
Someone told me that I am delusional, I almost fell off my unicorn.

User avatar
nova
applies for custom title
Posts: 49
Joined: Tue Dec 09, 2014 6:55 pm
Location: Planet 892-IV

Re: tips and tricks for everything but emacs

Unread post by nova » Sun Jul 19, 2015 9:25 am

Nice! Thanks for sharing Stark.
difficile est saturam non scribere. nam quis iniquae
tam patiens urbis, tam ferreus, ut teneat se...

User avatar
stark
MILF
Posts: 521
Joined: Sat Sep 27, 2014 6:38 pm
Location: Arpanet
Contact:

Re: tips and tricks for everything but emacs

Unread post by stark » Sun Jul 19, 2015 12:54 pm

@simgin I use geany's terminal to open emacs in noX mode and then use emacs's ansi-term to use vim ;)
If you can do it go ahead and do it, if you can't do it then don't even criticize it. - gingerdesu

User avatar
simgin
Meme Fodder
Posts: 1167
Joined: Sun Jan 06, 2013 12:07 am
Location: Bradford-on-Avon, UK

Re: tips and tricks for everything but emacs

Unread post by simgin » Sun Jul 19, 2015 3:19 pm

^ wow mate :D
I know some people also use Geany as a poject overview. Hmm, maybe I should try that.
Someone told me that I am delusional, I almost fell off my unicorn.

User avatar
kexolino
Common Boob
Posts: 557
Joined: Sun Jun 16, 2013 1:57 pm

Re: tips and tricks for everything but emacs

Unread post by kexolino » Thu Jul 23, 2015 2:01 pm

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.

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: tips and tricks for everything but emacs

Unread post by pidsley » Sat Jan 30, 2016 4:37 pm

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)

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: tips and tricks for everything but emacs

Unread post by rhowaldt » Sun Jan 31, 2016 6:45 am

hahaha, great :D
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
stark
MILF
Posts: 521
Joined: Sat Sep 27, 2014 6:38 pm
Location: Arpanet
Contact:

Re: tips and tricks for everything but emacs

Unread post by stark » Fri Jun 17, 2016 2:46 pm

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
If you can do it go ahead and do it, if you can't do it then don't even criticize it. - gingerdesu

User avatar
ivanovnegro
Minister of Truth
Posts: 5448
Joined: Wed Oct 17, 2012 11:12 pm

Re: tips and tricks for everything but emacs

Unread post by ivanovnegro » Sat Jun 18, 2016 3:01 pm

Wow.

User avatar
ChefIronBelly
Approved BBQer
Posts: 1044
Joined: Mon Jan 13, 2014 6:01 am
Location: Michigan

Re: tips and tricks for everything but emacs

Unread post by ChefIronBelly » Sun Jun 19, 2016 1:00 pm

^ yes and thanks stark
(1/1) Installing: LinuxBBQ...................................[69%]==============[/]

arnold
Window Manager
Posts: 51
Joined: Fri Jul 10, 2015 5:21 pm

Re: tips and tricks for everything but emacs

Unread post by arnold » Wed Jun 22, 2016 1:57 pm

Thank you Stark. This inspired me to download all the Skeptoid episodes.

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: tips and tricks for everything but emacs

Unread post by wuxmedia » Wed Aug 10, 2016 11:56 am

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.
"Seek, and Ye shall find"
"Github | Chooons | Site"

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: tips and tricks for everything but emacs

Unread post by pidsley » Wed Aug 10, 2016 3:10 pm

^ 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

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: tips and tricks for everything but emacs

Unread post by wuxmedia » Fri Sep 16, 2016 7:13 am

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...
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
Snap
Sperminator
Posts: 189
Joined: Sun Oct 05, 2014 8:11 pm

Re: tips and tricks for everything but emacs

Unread post by Snap » Fri Sep 16, 2016 9:33 am

^ That's a great one! Thanks, wux.

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: tips and tricks for everything but emacs

Unread post by franksinistra » Tue Nov 22, 2016 1:01 pm

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"'
rice no more.

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: tips and tricks for everything but emacs

Unread post by wuxmedia » Tue Nov 22, 2016 7:50 pm

did you find that one on commandline fu? META
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: tips and tricks for everything but emacs

Unread post by franksinistra » Tue Nov 22, 2016 8:29 pm

^ on reddit actually, earlier this year. Forgot the thread and the original author. :P
rice no more.

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: tips and tricks for everything but emacs

Unread post by franksinistra » Fri Dec 08, 2017 6:58 pm

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
rice no more.

Post Reply