{"id":8497,"date":"2014-07-20T05:07:48","date_gmt":"2014-07-19T19:07:48","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=8497"},"modified":"2014-07-20T05:07:48","modified_gmt":"2014-07-19T19:07:48","slug":"linux-vi-c-make-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/linux-vi-c-make-primer-tutorial\/","title":{"rendered":"Linux vi C make Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Linux\/vi\/Linux_vi_make.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Linux vi C make Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Linux\/vi\/Linux_vi_make.jpg\" title=\"Linux vi C make Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Linux vi C make Primer Tutorial<\/p><\/div>\n<p>The Linux (or unix) command <a target=_blank title='vi' href='http:\/\/pic.dhe.ibm.com\/infocenter\/zos\/v1r13\/topic\/com.ibm.zos.r13.bpxa400\/vi.htm?resultof=%22%76%69%22%20'><i>vi<\/i><\/a> is a powerful command line editor tool which has a long history with unix and the maintenance of C code (as just one example of its uses).<\/p>\n<p>So much so, as far as C coding goes, that the creators of <i>vi<\/i> clearly thought you may &#8220;set up shop&#8221; in the <i>vi<\/i> world, because, if you have a makefile, like our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Linux\/vi\/makefile._GETME\" title='makefile'>simple one<\/a> for today&#8217;s tutorial, you can use <i>vi<\/i>&#8216;s :<i>make<\/i> command to compile your C or C++ code while in <i>vi<\/i> &#8230; for those thinking that they never &#8220;make&#8221; syntax errors in C &#8230; hope you know where all the <a target=_blank href='https:\/\/www.youtube.com\/watch?v=A0xTEUBEQUs' title='Kryptonite'>Kryptonite<\/a> supplies are?<\/p>\n<p>You&#8217;ll notice that you can run that compiled code (if successful) and still not leave <i>vi<\/i> via :<i>!.\/Hello<\/i> (where the ! is taking you to the parent shell).<\/p>\n<p>There are other text editors for command line Linux (or unix), some being <a target=_blank title='pico' href='http:\/\/info.eps.surrey.ac.uk\/FAQ\/pico.html'>pico<\/a> and <a target=_blank title='emacs' href='http:\/\/www.cs.colostate.edu\/helpdocs\/emacs.html'>emacs<\/a>, and there is a bigger version of vi called <a target=_blank title='vim' href='http:\/\/www.vim.org\/'>vim<\/a>.<\/p>\n<p>The thing about a lot of command line text editors is that they look unfriendly (it&#8217;s less unfriendly if you know {ESC}: gets you to the : prompt from the screen view &#8230; second green arrow in tutorial picture included this), and that can be true, and this has lead me to do more work with the GUI <a target=_blank href='http:\/\/www.macupdate.com\/app\/mac\/11009\/textwrangler' title='Mac TextWrangler text editor'>TextWrangler<\/a> (when on a Mac) if there is going to be much cutting, copying and pasting, but you should know that <i>vi<\/i> has functionality to do with buffers, and some years back, there were maybe 6 or 7 days I&#8217;d have preferred to do copying and pasting between buffers using <i>vi<\/i> &#8230; you&#8217;re right &#8230; I&#8217;ll <a target=_blank href='https:\/\/www.youtube.com\/watch?v=BF6ffbz70SY' title='Take a Bex and lie down'>&#8220;take a Bex&#8221;<\/a> and lie down now.<\/p>\n<p>Here is a link to some downloadable C code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Linux\/vi\/Hello.c_GETME\" title='Hello.c'>Hello.c<\/a> and its associated <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Linux\/vi\/makefile._GETME\" title='makefile'>makefile<\/a> designed for Linux command line compilation via <a target=_blank title='vi' href='http:\/\/gcc.gnu.org\/'><i>gcc<\/i><\/a> (and here is a good tutorial regarding <a target=_blank href='http:\/\/stackoverflow.com\/questions\/1484817\/how-do-i-make-a-simple-makefile-gcc-unix' title='gcc makefiles'>makefiles<\/a> for <i>gcc<\/i> compiler &#8230; thanks).<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d8497' onclick='var dv=document.getElementById(\"d8497\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=text-editor\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d8497' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The Linux (or unix) command vi is a powerful command line editor tool which has a long history with unix and the maintenance of C code (as just one example of its uses). So much so, as far as C &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/linux-vi-c-make-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,29,37],"tags":[176,234,242,478,707,723,742,743,997,1255,1319,1339,1368],"class_list":["post-8497","post","type-post","status-publish","format-standard","hentry","category-elearning","category-operating-system","category-tutorials","tag-c","tag-command-line","tag-compiler","tag-gcc","tag-linux","tag-mac","tag-make","tag-makefile","tag-programming","tag-text-editor","tag-tutorial","tag-unix","tag-vi"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/8497"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=8497"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/8497\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=8497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=8497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=8497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}