Menu
+

About Get Support

Results for category "tutorial"

2 Articles

[Part 1 of 4] Keeping Sanity: VIM environment

/* Preamble: I have a problem, and it's best described by that scene in S03E06 of Malcolm in the Middle. I can’t create Z without going through Y. Can’t do Y unless I finish X. There’s no X unless I can compile something. Can’t compile the things, without getting a vim environment polished. Why even use vim? Because it’s better than nano.. Why not something modern like visual basic, or something normal w/a GUI? Because.. reasons.. and stuff..  >_< Augha! How to read? (right, because you can’t vim without being able to optically phrase strings via the eye organs) .word is pronounced “dot word”. ([{}]) brackets, curls, parentheses, dictate thoughts within thoughts within thoughts (or embedded thoughts to 3rd, second, and first degrees). Each outer set of thoughts can be read independently from each other without disrupting (really?) continuity of each other. Furthermore, (I’m really just experimenting [in a weird way] with this) usage of (lack-of) commas et al. Forms of grammar are hereby taking a backseat when paired brackets/curels/ parentheses come into play. Extra points to me if can write something with 4 levels of embedded-ness. This blog is really just a collection of side notes I wrote through my vim.wiki and I’m writing it now because I’m stuck AF on those aforementioned Z, X, Y items. Also, I’m rediscovering rap music and I think it’s my 5th, no 6th cup of coffee at 8 PM. Thinking back, it could’ve been worse. Alternatively, it could’ve been night-core. I managed to recreate all the mini tutorials on here on a VM (virtual machine) install, so stuff should similar work. If it doesn't, you’re doing something wrong (or everything). That or, check your repository source.list. There’s an inherent risk in relying too much on centralized repos.. Remember October 21st? This author does. Am I an author now? Yes,yes I am. (Read: Yes – pause – yes I am. Because that’s how you should be reading commas. There needs to be pause, but not  a pause that’s as long as a period-pause. I can’t really dictate how fast someone reads, nor am I in any position to recommend how long I thought to take one’s mind to go through these strings. I mean, I guess I could recommend a 16 over 8 or 16 beats/syllabus per meter type or recommendation and thus a comma is equivalent to a bar flat and a period is just a %/celta in disguise. Maybe we can try that. Therefore, by that standard, embedded thoughts [({}] are meant to be considered in a subjected mind. E.g. if you’re reading this out loud, don’t read the embedded thoughts out loud. Else, if you’re reading this in your mind, skip over the embedded thoughts. Maybe.. I can place these embeded thoughts in as “alt text” with an <alt tag> if that’s at all possible so they only show up when someone hoovers over them with their mouse – if that’s possible at all. Else, I guess I could just rewrite the entire sentence structures so they follow a real non-made-up English standard. I hope my college professors never read this). At this point, I’m considering putting all this text inside a scrolly window thingy so it doesn’t take up to much fake-real-estate on a person’s screen. What window would make a proper height dimension? Okay, I’m butchering it. The purpose of any of this is to put something out there for others to read, and if you’re reading/speaking/rapping any of this it was somewhat enjoyed. Preamble END.
*/

Author’s note: I promised myself I would get to around to finishing this post properly, but now I want to post another post which would refer to information in this post. In practice, all one needs to do to get things going is to have pathogen() set up, and to compile their vim with the python option. Most people will struggle with installation if they have conflicting versions of python set up, but if you already have this ready, then you don’t need to go through the rest here. Jump on over to this post if you’re interested in how to set up a LaTeX environment using vim!

One of the first pleasantries people have with vim is realizing they can’t copy/paste from within the terminal to external programs. The reason for this is that natively, vim uses an internal buffer to save memory from your yank/paste commands. Inconveniently, said buffer isn’t shared with your system’s clipboard. Okay, first let’s address this by adding some extra lines to our ~/.vimrc (henceforth referred simply as ‘your vimrc’ or ‘the vimrc’ or simply ‘.vimrc’ [pronounced “dot vim r-c”]). Find it by heading to ~/ and ls -la or just ls -a. Don’t know what these commands do? Try man ls.

Vim .vimrc (or vi .vimrc)

map <C-c> "+y<CR>
map <C-v> "+p<CR>

No need to use a leader key, nor install another program like xclip. What this does is that it basically copies what you’ve already selected in visual mode and saves it into a shared buffer that you can access from outside of vim. The “+y and “+p commands might require you to have compiled vim with the +clipboard configuration. More on this below. Within your .vimrc, however; you’re simply creating a macro with the “map <C-c> macro <CR> script. The <C-c>/<C-v> represent ctrl+c/ctrl+v respectively. :wq and restart any of your vim instances so that they pull the updated macros from you .vimrc. Congratulations, you’re now on your way to making vim great again!

Some uploaded dotfiles here (warning, not up to date and may change at random times)

git clone https://github.com/sansloi/dotfiles.git

Back up .vimrc before you swap it with what is on there. Warning, you’ll get warnings (but not errors; about 30 of ‘em). Pretend the files in the git repo are not up to date, but basically the idea is to have someplace where one can quickly reconfigure a foreign machine to their liking. This is especially true when you’re going through multiple virtual installations or if you happen to travel a lot. For me, I get to share my dotfiles with others. It opens up the possibility to getting feedback from peers if anyone cares enough to point something out. The remainder of this post will include some short summaries on adding in additional functionalities to vim – mostly via plug-ins.

[WARNING:] This is not a quick guide on how to install vim. If you’re having trouble installing a feature though, maybe this will help.

Keeping Sanity Part 1: Creation of a VIM environment

  • Install VIM from source
  • pathogen() et Cetera : vim-sensible, nerdCommenter, indentLine, NerdTree, NeoComplete

Install VIM from source

So there’s the thing.. a lot of vim installs you’ll see that come from a vanilla OS distro will be ‘light-weight’. It’ll have enough content (minimum/small/tiny) to let you look at a file, and was probably compiled under a minimum configuration. Not only do we want to unlock some of these (huge/large/full) features, but we might as well grab the latest version of the software while we’re at all. If you’re on Debian Jessie, then you’re on an older developer cycle compared to, let’s say Ubuntu 16.04 or w/e number they’re on now. Translation: your software can apply for medicare. We want a younger, newer, more fertile version of that. Yet, at the same time we want new, but not experimental-new. Therefore, we’ll compile the latest stable version from source. Warning: Wash your hands after you use the bathroom, and review the source before you git clone something. While you’re at it, make sure your /etc/apt/source.list doesn’t just go tunnel into some stranger’s server, and check the public keys you’re accepting. Honestly, the only real reason we’re git cloning in this post is because we’ve already accepted convenience for security. Didn’t your parents teach you to ….

Some background parameters:

apt-get install git

should be about 25Mb

mkir ~/Projects ; cd ~/Projects
git clone https://github.com/vim/vim.git
vim --version

:echo has("lua")
returns 0

If it returns 0, then False.. You’ll want lua for neocomplete et al.

 sudo apt-get install lua5.1 liblua5.1-0-dev

time to PURGE! (maybe save a backup. don’t be too brave)

sudo apt-get remove vim vim-runtime gvim vim-athena vim-gnome vim-gtk vim-nox

virtual packages lik e’vgim’ can’t be removed, …okay
time to … from source

 

sudo apt-get update; sudo apt-get -y upgrade

python3 -v (or python3 --version)

 

on my host machine it’s version 3.5.1
on my VM#001 it’s 3.4.2
on raspi#1 it’s 3.4.2
Simple steps to install + configure the vim

cd ~/Projects/vim

./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.5/config \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk2 --enable-cscope –prefix=/usr

note that the python paths… /config paths will be machine specific
for  python2.7 I have “/usr/lib/python2.7/config-x8.6_64-linux-gnu”

python3.4 I have “/usr/lib/python3.4/config-3.5m-x86_64-linux-gnu

python3.4/config-3.4m-x86_64-linux-gnu/ is the path for VM I was running.
yours will be different.

For my Jessie-LTE dist on my RaspberryPi B+ (and here I am giving away my system specs again, please don’t hurt my robot) it’s going to be /usr/lib/python2.7/config-arm-linux-gnueabibf

and

/usr/lib/python3.4/config-3.4m-arm-linux-gnueabihf

So the idea is to find where your system keeps its shared libaries, and then link them by editing your ./configure command and/or file. In these examples, you’re hunting for whichever directory holds the .so extensions. To find out what you’re looking for in the pythohn2.7/”config” and python3.5/”config” paths, you’ll need to actually cd into them on a separate terminal and look around to find their address.
Try this:

cd /usr/lib
ls python <tab> <tab>

for python3.5.. i don’t think i have this. It’s not part of any of the repositories I’m subscribed to at the moment, so I might have to manually install it. We’re not going to do that. I do however have 3.4 installed.

The idea right now is to go through the “Makefile” that comes with this vim repository and see what other ./configuration options I have available. then I can simply write down and plan my install here before I run it

if you compile vim w/o specifying anything, you will get the default behavior as is documented. You might as well have done sudo apt-get install vim and gotten your distro’s version of what is current. That’s not reason I’m writing this, and it’s not the reason you’re reading this. So what’s happening when you’re installing?

./configure “shell”
attempts to guess correct system values. Usually if you don’t have the correct libraries, or if chaos happens, this is where you will find out. The errors made are often enough fixed by manually going through and make changes at the lines the terminal spits out. If all goes well, the ./configure makes the makefile for your machine. The makefile installs the program. You can pass config values when you execute the ./configure file. If for some reason you can’t run it (especially if you’re SSH’d on a client Raspi) go back to ls -la and make sure you can access it from a client by using chmod on the file permissions.

./configure (with --options)
make %%to compile
make install %%to install your compiled program

./configure --with-features=huge --enable-multibyte --enable-rubyinterp=yes --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu --enable-python3interp=yes --with-python3-config-dir=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu --enable-perlinterp=yes --enable-luainterp=yes --enable-gui=gtk2 --enable-cscope --prefix=/usr

make distclean
however if the make file is corrupted
rm auto/config.h works too

note: once you uncomment/comment the needed features, for python 3
for Python3s support make a symbolic link in /usr/local/bin:

try /usr/bin
ln -s python3 python3.5

or

ls -s python3 python3.X where is X ir Xm or 3.4m is the binary you’re looking for (against this is machine dependent)

then

make distclean
and use the uparrow to go back to that really long ./configure command you spent 5 minutes making sure you spelled right and run it again.

but what if you don’t have python 3.5 installed? Instead of going through the process of installing yet something else just settle with 3.1 or 3.2 if that’s what you have. They’ll be backward compatible; however, do not expect python 3.X to be backwards compatible with python 2.7.

ln -s python3 python3.1

make reconfig or make ./configure (all of that)
make
sudo make install

Congratulations. You can now check your vim install by typing

vim –version

Cross your fingers.

them GUIs with that F5 button refer to it as a \! “bam” It’s like when one makes a statement that their code will compile.. An audible wager to what usually becomes sudden disappointment, but worry not. It’s not really your code, so don’t be too disappointed.

 

So, what if none of that worked? Let’s Take a step back.. How “fresh” are your libraries? I should’ve mentioned you’ll probably want the -dev libs as well.

sudo apt-get install python2.7-dev python3.5-dev

Do you need python3.5-dev? Maybe you want *3.4-dev??? (hint*, hint*)
//this will put in a number of necessary libraries into your /usr/include/python2.7 and will save you sanity when bug hunting trying to figure out why you didn’t need to do anything on your own machine versus a new VM. As a rule of a thumb, if you’re going to be enabling any –language-interp make sure you also have the languageX.Y-dev installed by it’s side as well. You can keep calling “make” and so long as the errors keep failing on different lines, congrats. you’re making progress. Depending on your repo (e.g. if you’re using something more exotic than something debian base) packages (if that’s even you call them) just know that those repos could use completely different naming standard.

Aside from this, another major problem people will face is that their source list wasn’t configured. Anyways, once your terminal finally gets to that last make[1] : leaving dir… line you’re legally allowed to jump from your chair and yell woot.

Now you can sudo make installation
don’t forget the ‘sudo’ part :0

now do vim –version

and on the “feature list” note the apperance of +lua and +python*
These are the ones I need in order for the vim plugins that we’re going to install to work.

Congratulations! \o/ Okay, if you got vim to install with no issues, you can skip this next sub-section and go on to section 2. The items below are not necessary to install the plugins covered in section 2.

Only For the Mad

If for some reason you still can’t get things working or if you need to manually modify your make file (you shouldn’t) then you’re insane. But perhaps the following will aid some yet to be madman (or woman) in their quest to “complete installation-hood.” There are more features in vim btw. Go back to that vim –version thing. Plus.. with the below stuff, you can put your name on that vim –version list. Read on mad person.

There’s a -hangul_input listed. As a fun exercise I decided to recompile and include that feature into my vim install. As a ‘fun’ exercise. Turns out, writing and rewriting that ./configure command is cancer, so I wrote a *quick* shell script that’s (I think) quick to read, and easy to modify. The entire purpose is simply to modify the ./configure by just adding a new line and using the exec command the script runs through each lines. The way it’s written, the only thing I need to do is place it in the top /vim directory where the same “configure”. So step 1. add a new line with the feature you need. If you require specific function names, you’ll have to dive into that make file in /src go find it.

Steps on how to enable Hangul on vim

Step 1. change line 6 to reflect the path location inside that vim directory you git cloned.

Step 2. save and chmod x+u installConfig.sh

Step 3. sudo apt-get remove vim and sudo makeclean (nuke the things)

Step 4. /installConfig.sh (this instead of the long ./configure –all-that-jazz)

Step 5. make

Step 6. make installation

Step 7. Ask yourself why you’re doing this again

Step 8. Realize you don’t actually need it. Having played around with it, it turns out I don’t actually need this feature to use Hangul on vim. It only makes it a bit more convenient to use when switching between languages. I can’t speak for the other languages seeing as I never used them, but they’re there as well for anyone daring enough to try them.

Hangul Test Text

ㅋㅈㅋㄹㄹ쿄요요외우야사앚랏제랈ㅋ제레제
[[ㅓㅏㅣㅑㅣ마ㅓㄴ이ㅑ덕] ]
it seems like I can insert the characters under insert mode but i need to manually switch between my key mappings externally before I can use this keyboard to exit insert mode. e.g. ctrl+c or will attempt to type ctrl+

Sill lost?

Okay, if you’re not using the configuration script, or if you’re not copy/pasting from the code window below note that all these “configuration” processes do is configure the make file that you actually then compile. Vim as a straight forward make process (yeah! Thank you developers!) so this config process doesn’t make an entire makefile from scratch. It just edits what the that’s already there. You can manually go to the makefile located in /src/MAKE to find the needed variables and comment/uncomment them to turn on/off the features you need when your compile your vim environment. If you do go into the makefile though here’s what you’ll need to switch on that hangul_input feature. Note there running the configer process in the top folder creates a makefile in the top folder. You can edit this one if you’ve already ran config. If not you can go attack the one in the src folder, but you’ll be have to hunt down the variables on your own (e.g. use my bash script! Branch it! And heart it on the github!! :D )

humm.. maybe I should go through all features and write comments on what your paths should be, and then note down the necessary libraries you should have installed… wow. I don’t want to do all that. Yeah, I’m not going to do all that. If for some stranger reason you need to have that +xfontset feature, vim /\vxfontset <enter> <n> <n> <n> <uncomment> <:wq>. By enabling –huge you’ll activate a number of the features. The trade off is that your install will be heavier.

error: not an editor command
in order to track down your variables…

grep -nr ‘hangul*’

there’s a Makefile (one out of 14 files that start with make*) inside the src folder around line 403 and 1578 that look suspicious/promising

without even viming in, we can see that src/Makefile:503:#CONF_OPT_INPUT = –enable-hangulinput

Between lines 496 through 503 there’s a block of code covering xim and enable-hangulinput. Odd that -xim has both an enable and disable function for it as opposed to just one –enable that acts as both depending on if it’s commented or not. So from here you can either uncomment line 503 in the vim/src/Makefile then make inside of the src file –> sudo make install, or you can add a line to the bash shell file with

–enable-hangulinput

–enable-xim

sudo apt-get install gpm

gpm – a cut and past utility and mouse server for virtual consoles

let’s do that as well. Is it running?
ps -IC gpm (maybe wait for a reboot)

if you’re too cool for mouse support you can –disable-gpm (or –disable-sysmouse on FREEBSD/DragonFly) otherwise it should be on by default assuming you have sysmouse or gpm already working (e.g. wait for a reboot) Also, if you’re going to be adding additional lines to the bash script to automate your configuration command, make sure you leave a “\” at the end of each line in that block of code if it’s not the last line. On the terminal, using \ basically tells BASH to hold and continue the command onto the next line. It’s easy for organization really (e.g. makes it easier to read for your human eyes) Oh. One more thing. Since you’ve taken the time to compile vim from source and read this blog, there’s one last thing you can do for fuconfig-arm-linux-gnueabihfn to and be proud of yourself for having gone this far. In the bash script add in this line.

--with-compiledby=”Your Name <yourHandle@yourDomain.net> “

make sure the items on the RHS are in “ “ because this will simply get read as a string that’s outputted when you vim –version or :version inside of vim.

^_ ^b

When you’re reading. Kill vim. Remove compiled versions from the vim folder. And start again. Cross your fingers*

on it.
src/Makefile:
/hanguel somewhere to line 500 something

uncomment
make clean
make reconfig
make
sudo make install

multi byte languages

let’ see

ㅐㅏㅐㅏㅐㅏㅐㅏㅐㅓㅐㅁㄴㅇ리ㅏㅣ머;ㅏ너디;마ㅓㄷ러ㅣㄷ
okay

hum…probably should have noted the differences better. i think ctrl+c got me out, but still acting odd.

when a config file is 10s of thousands of lines long, blah. Kudos to the fine folks who took part of their lives to comment that documentation – hats off. To recap. You can ./configure with the –options to make the configure file automatically detect your configurations. If you’re having problems with this, then you’ll need to vim right into the configure file itself and uncomment (delete the #) the lines you want your makefile to phrase. Yes, this will require reading more instructions. Yes, this will require you to know which options you’re looking for and where they’re actually (hint: use the /search string feature) located in the file. No, I can’t just give you mine because an exact makefile will include paths that are system dependent.

Make distclean
./installConfig003.sh (because you should have copies of your copies backed up)

Now when you vim –version

you should see the features you wanted included on that list and your name is on it! That way, if anyone uses this newly compiled software, and it breaks, they’ll know who’s office to go to and complain about it. “Oh, bob shipped us a broken vim environment again, damn it bob”

oddly enough, I can’t seem to get -hangul and -xim to show up on my VM environment

hum..

when you do “make” it goes ahead and runs ./configure with the options in the Makefile
so you either run the ./installConigueration003.sh file or the ./configure but not both.

Still nothing.. at this point, I’m not sure why it isn’t working on my VM environment. Apparently, I managed to do this on my work machine, but there’s something missing.. at this point the only real thing I can do is try to properly define my problem definition and then research the hell out of it.

Problem Definition: WhyTF isn’t this feature working on a my virtual machine image?

sudo apt-get purge vim

this language support is for folkls with no XIM support so –disable-xim

feature.h
Error: can only handle multi-byte feature with 32 bit int or larger
maybe it has something to do that I’m running a virtual 64bit machine, but i’m compiling inside a real 32bit machine?
In my shell script, it seems that any new line enabling a feature that’s listed on the feature list works iffi =yes is applied . Not every configuration option requires this, but for xim and hangul this will be required.

What if I wrote a bash script that stream edits the makefile in src and use that to compile?

So, my VM machine did not have the libx1-dev and a few other libraries in it since it’s a baby brand new system I’m using for testing purposes.

which vim
sudo update-alternatives –config vim

From here you can select the default vim you’re on (give it the highest priority)

time to play with a new copy of my install script
I’m going to change –enable-gui=auto as opposed to –enable-gui=gtk2 since a generic machine might have a different flavor of linux on it. I’m assuming that the long make file goes through a list of popular options it phrases through, but gtk2 was what the host machine had on it.

going back to *003
+xim and +x11 are included this time, but not hangual_input

starting to suspect that xim and hangul_input are exclusive (e.g. install won’t support Chinese and Korean concurrently via option) but it does? There are 2 Xim options in the makefile (to enable and disable) and one in line 510 for hangul_input

503 # XIM - X Input Method. Special character input support for X11 (Chinese,

504 # Japanese, special symbols, etc). Also needed for dead-key support.

505 # When omitted it's automatically enabled for the X-windows GUI.

506 # HANGUL - Input Hangul (Korean) language using internal routines.

507 # Uncomment one of these when you want to input a multibyte language.

508 #CONF_OPT_INPUT = --enable-xim

509 #CONF_OPT_INPUT = --disable-xim

510 CONF_OPT_INPUT = --enable-hangulinput

If all else fails, you probably already succeeded installing vim. Go to ~/Programs/vim/src and what you’re looking for should open with ./vim within that folder. To verify it’s the baby you created ./vim –version and it should show you the features you included along with “compiled by <your string>” and the time recorded when it compiled. Woot. You may already have a previously compiled version of vim which you also compiled in your mad attempt to get the program working. You’ll probably find that in /usr/local/share/vim” Chances are that it may not be the program you’re looking for. In that case, you’ll either want to replace it with the one in your home folder or if you want to keep it for some reason maybe add the home folder one to your .bash_alias? It’s not recommended to randomly be installing programs outside of a package program (such as aptitude) without someway to record and track it. If for some reason you’ve read this far, we both know this rule doesn’t apply to you. Those management programs don’t keep up with the bleeding edge development cycles that define your exploited world. For everything else there’s git, but for now just keep a notepad with comments on where you’re keeping your stuff. e.g. in a directory called “/Programs.” Anyways, there’s a hierarchy of paths your %PATH will look into. Placing it in your local .vimrc will make bash/fish/or w/e call in your locally compiled ./vim before grabbing it from elsewhere. If you’re ever unsure which environment you’re in, ./vim –version

Okay, I realize this post might be long. Half of you will simply skim through it, the other half will actually read it – I don’t know why you’re doing that. So, it’s common knowledge that a person’s attention span is, what maybe 15, 20 minutes? Thus the purpose of different study strategies, which would also include reading. You might’ve noted some of your better professors or slide-show presentors, who will crack a joke or do some sort of attention grabber to get a student’s focus back on the subject. if it takes ~7 minutes to read roughly 1,600 words as stated by this article, and since we’ve established that the ~15 minute reading thing is real, I reckon that by now I should do something to grab your attention. Here’s a smaller sub-sub-section of extra things to do with your computer.

Extra! 15-minute-mark-not-so-subtle-reading-fatigue-attention-generator

So yeah, about the vim thing, typing “20b” to go back 20 words when at the end of a very long paragraph written on one line in vim is very annoying. therefore… ctrl+c

:set mouse=a

to turn on mouse support on your terminal. I prefer limiting it to just insert mode. Compile with +mouse support if it doesn’t work. Not sure? :version will tell you. Other available arguments to mouse include.

a = all
n = normal mode
v = visual mode
i = insert mode

You can combine these too to create compound rules. e.g. mouse=vi for visual and insert, but not normal. Having it on normal just gets in the way. The above can also be placed in your .vimrc.

apt-get install fortune cowsay lolcat

.bashrc –> turn on .bash_alias (uncomment, usually)

 vim .bash_alias

(to edit or create, start putting it your aliases, check maybe the dotfile directory previously mentioned for ideas or just make your own)

alias wisecow='fortune | cowsay | lolcat'

and remember to source your .bashrc. Of course, none of that was necessary, you could just manually pipe them, but you will need to source that .basrc.

source .bashrc

cowsay what now?

Pathogen() et Cetera

Now with vim compiled avec lua, python, hangul, et cetera +features we can move forward. I learned that et alii translates to “and all,” people, whereas; et cetera translates to, “and others,” things. In order to install other packages within your vim installation, we’re going to install a package to install packages so that everything becomes neat and packaged. Not even joking, Pathogen() is literally a package to install packages. Well, not literally, but essentially. It’ll add the path of vim add ons onto your vim run path. If you’re fortunate, you might even be able to install pathogen from your apt-get package. But here, we’ll just git clone it. Other popular vim packages for installing packages exist, but the author likes Pathogen(), and thus here we continue.

Install Pathogen()

mkdir -p ~/.vim/autoload ~/.vim/bundle && cd gitclone ~/.vim/autoload
# cd into your /autoload folder then
git clone https://github.com/tpope/vim-pathogen/blob/master/autoload/pathogen.vim

To tell your vim instance what to execute, go inside of your ~.vimrc, then drop

execute pathogen#infect()

at the top. If you want to see an example, you can grab a copy of my .vimrc from the aforementioned dotfile folder. Form now on, you just need to git clone inside of your bundle directory and modify your .vimrc in include lines needed to modify a package’s behavior. Some packages won’t run unless your vim environment has been installed with specific features running, and some if not most packages will require modifying your .vimrc in some way. Consult the proper readme.md /install.txt/documentation for specifics.

Sensible
Why use the Sensible plugin? It’s somewhat of a non-defacto standard. Face it, you’re vim environment will differ form your neighbor’s vim environment which will differ form your co-worker’s vim environment, which will differ from your mother’s vim nonviolent.. etc. etc. Of course if your mom raised you well, you would’ve grown up with a well organized .vimrc format and there’d be little need to continue reading. Sensible isn’t an official standard. It won’t be something found in a ISO library. It is, however; a sensible place to begin a .vimrc file. This is especially true if you’re setting up a vim environment on a remote host that multiple people will be accessing.

cd ~/.vim/bundle && \ git clone https://github.com/tpope/vim-sensible.git

And that’s it. Note that the repo in mention, like all the other repos here, are subject to change whenever the repos’ admins feel like it. You should actually spend some time looking through the source to check if there’s anything sketchy before you run it, and try not to test new stuff on a live system. Again, this goes back to the things mother should have thought you. Tidy up your .vimrc file, don’t test on live systems, and verify the binary, nay, the source code’s PGP keys. Find the canary, or lack thereof, and assume your adversaries like to make lists of any software mentioned in your blogs. Don’t mention mission critical programs in your blogs. Misinformation in your blogs. Google is not your friend in your blogs. What else? there’s not really much to write about with these plugs in. You’ll just drop the .vim files in your bundle directory and pathogen will find them. I guess, we could talke about the process of contributing to a git repo, or how to push/pull changes?

NeoComplete
For the quick install first make sure your installation was compiled with lua and is running under one of several graphical environments. If you followed the instructions line by line in the previous section then that’s probably a bad thing, and I apologize if your system broke because of it. Assuming you did,  you’re probably using gtk (gnome took kit). This isn’t the only option available though and others exist. This plugin, however; will be one that will not work if you did not compile from source, or if your original distro has it. Must don’t from what I’ve experienced. Again, drop this into your aforementioned /bundle directory:

git clone https://github.com/Shougo/neocomplete.vim.git

Now from inside a running vim thread, execute the :NeoCompleteEnable command to enable it or in your .vimrc

let g:neocomplete#enable_at_startup = 1

Note: If you search for neoComplete through the github search bar, you’ll find numerous other repos with similar or even better, more reliable code. Many of these are reputable repos, while some will always be questionable. In this blog post I’ll try to only link to places I think are reputable, but please don’t consider my recommendations solid. You should check your downloaded source and keep your own local copies if you see yourself putting these on multiple machines. You don’t want to be git cloning a script that was removed or edited while you were not paying attention.

NerdTree

git clone https://github.com/scrooloose/nerdtree.git

Toogle it with

:NERDTreeToggle

To change the symbols used in the split panel, and to map the toggle command to your leader, add these to your .vimrc. Any ascii table symbol is valid, but you might want to restrict it to something that makes sense. Furthermore, you can specify how much space the split panel takes up as shown below.

map <C-n> :NerdTreeToggle<CR>
let g:NERDTreeDirArrowExpandable = '☭'
let g:NERDTreeDirArrowCollapsible = '☣'
let g:NERDTreeWinSize = 29

The icon above is due to wordpress’s automatic parsing thingy – interesting. I think I’ll leave it on there. Here’s a case study on NerdTree useage. Bellow and to the left, you’ll see that I have a run time error occurring due to my apparent misuse of a header file from a JSON parser library I’m testing out. So let’s go investigate. Save the current .cpp you’re working on and then just hit <leader>+n [or h/e your .vimrc has it set up]. A split screen will occur and you can go digging through the library header files and click on the file your error code on the right terminal screen spits out.

Above and to the right, you can hit “gg476” to jump to the line the run-time error gave out. As you can see, you’re inside a large header file with hundreds of lines of code, and you didn’t write any of it. Furthermore, the documentation on the library stinks. Yes, the comment does read, “Should only has one and only one root.”  It is not your job to decode all of this. Before you start going, “Wtf does any of this mean? Why isn’t anything working,” be glad the library authors decided to open source it, and be glad you even have something that hints at what you should do. However, with all this decoding mess I find myself in, I can say that nerdTree helps ease the investigation process a bit. I could probably save a lot of time by choosing a more mainstream JSON parser with better documentation, but that’s another blog post entirely.

nerdcommenter: https://github.com/scrooloose/nerdcommenter
note: in visual mode type cc to comment out selected
type <leader> cc
for me it’s “,cc” vim will wait X milliseconds. Don’t have a leader? GO back to your .vimrc and make one. How? Look up on that example .vimrc linked above.

again: go to visual mode, select the lines you want to hit, type ,cc and behold.v
What’s amazing about this plug in is that it detects which language you’re writing in and puts in the corresponding comment sign on your file for it what’s even more amazing, this being vim, is that you can simply ~./vim/bundle/nerdcommenter/pluginNERD_commenter.vom and add your custom inputs for any arbitrary language that is yet to be designed. included by default are everything from ada, django, from aap to  z8a. Furthermore, the beauty of these 3043 lines of code is that it’s all under a “WTFPL” license all this to happenb

set timeoutlen

indentLine

This plugin gives you tab power! And more importantly, you’ll see some vertical dashed lines connected your tabbed and out-of-phased horizontal lines. This helps when you’re writing code and things get messy. It’s a nice visual aid to have.

cd ~/.vim/bundle/ 
git clone https://github.com/Yggdroot/indentLine.git

(Extra!) how to github?

// side note, fish versus bash? really liking fish right now.
though, after making a change to bash_alias

// random stuff

alias notes=’vim ~/vim/bundle/vimwiki/index.wiki’
and then sourcing the file

// don’t even know why this is here

on one of my split terminal screens the alias doesn’t work whereas on the other it does. odd. odd odd odd.
cowsay that is odd!

// this is a really weird blog post

that W…

so, how to github?

git init
git add .
git commit -m "First commit"

git remote add orgin remote repository URL
git remote -v

git push origin master

how to set the remote?

* adding a remote // don’t actually do this

git remote add
git remote add origin https://github.com/sansloi/repo.git
git remote -v

== simpler steps ==
make repo and get a URL by using the browser gui. might be a way to do it by command line actually.

after that, hop back on terminal. Basically, I don’t know how to start a repo client side without first initiating the repo creation through the website server. Furthermore, there’s a social aspect to github, and I’ll acknowledge that I don’t have much of that social experience on it. It’s not too surprising though. Maybe I should contribute to a few projects and make some internet friends.

(Extra!, Extra!! – not vim related) Markdown – Typora

As stated on their website, markdown can be two things: a markup syntax (HTML is not a programming language), and a software suit. I was looking into vim options to terminal type and update a preview on the fly, but it got complicated. For anyone more daring than ..
okay, i want to live preview my markdown text.. i shouldn’t spend too much time on this considering the only thing in my project that uses markdown is the github readme file. but somehow it got complicated. so, here i am, going to spend more time trying to get this thing started than i might actually spend writing  it. also, it isn’t critical to creating a readme.md but it’s happening anyways

www.cpan.org/src/
latest version of perl is 5.22.3 22 this is an even number, therefore this is stable release
released on the 14th of jan. it’s now the 20th. (at time of writing, yes this has been in draft form for a while now..)

my current version installed on my local machine is perl 5.20.2

markdown is actually 2 things. the syntax, and a software. the vim plugin i plan to use needs the working markdown software running.
requires perl 5.6.0 woot. i have it. just a little mental math.. 2.3 is not 2.30 and therefore 2.20 is greater than 2.3… because any other comparison python or matlab will tel lyou that 2.3 > 2.20 but w/e. Maybe the original authors didn’t expect it to ever go beyond version 2.9?

sudo apt-get install python-software-properties
apt-get install software-properties-common

optional, but encouraged (note* be careful when you’re adding repos)

 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE

# add Typora’s repository
# sudo add-apt-repository ‘deb https://typora.io ./linux/’
# sudo apt-get update
# install typora
# sudo apt-get install typora

sudo add-apt-repository ‘deb htwtps://typora.io ./linux/’

joule@sid:~/Programs/xdotool$ sudo apt-get update
E: The method driver /usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?

so i installed that, didn’t need to before. should verify what changed to my erc/source lists

it works. fish doesn’t resource aliases quickly, but fish isn’t my default shell environment either.

(extra! extra!! extra!!) a bash-script for install vim (from source)
Okay, this should work. I tested it on 2 different machines, but ran into problems when i tried it on the Pi. Might’ve been because it was executed via ssh so you’ll need to chmod it with a different code, didn’t check. Successfully installed vim on the pi (with the correct python dirs) when I did it manually. This script just helps automate the process so you don’t have to write all the enables by hand. When you use it, you will need to change the config-dir paths (as mentioned in the first section). Finally, you’re welcome. I hope this helps at least one person. Remember to double check your paths. We’re not on the same machine, so thread lightly.

#!/bin/bash

clear
echo "Hello $USER"
echo "let's begin"
exec ./configure --with-features=huge \

--enable-multibyte=yes \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk2 \
--enable-cscope \
--with -x \
--enable-fontset \
--enable-hangulinput=yes \
--with-compiledby="string" \
--prefix=/usr
echo "it's finished"
#--enable-xim=yes \
#note: save this .sh file in the vim top directory, and make sure you chmod it so that you can use it from wherever your host machine is.

So, I’m thinking that this will not be a children friendly blog. Lots of [NSFW] content ahead – career ending type stuff. Some of it won’t be legal in Germany, some won’t be legal in Texas, must won’t be legal North Korea. I’m looking forward to the Texas stuff. Here’s a list of topics I want to touch on.

Keeping Sanity Part 2:

  • ROS+Gazebo and YOU! (a mini tutorial on communication between two worlds)
  • How to not burn up your laptop
  • server+client hierarchy

Keeping Sanity Part 3:

  • armadillo (a matrix library)
  • how to .json without actually .json-ing
  • modeling dynamics (with .json :X)

Keeping Sanity Part 4:

  • Training your Classifier [alternate title: “How to train your Classifier”, “Classifiers and YOU!”, “5 things you need to teach your Classifier right now”, “Classifiers and Race”, “A multi-cross-sectional analysis on classifier anatomy”, “A post modern-modern analogy to classifying classifiers”].” {srly note: So, I had a professor who bragged about being able to name drop submarine captains and what s/he was having for lunch based on the acoustics received from the sub’s engine. #RedOctober #crazyIvan}
  • FreeCAD versus SlaveWorkerCAD

Some other topics that might or might not already be in draft form

  • How to B-corp?
  • Saving bandwidth – An Introduction
  • A Gentleman’s Guide to Supporting your Local Anarchists [alternate title: “Capitalism and YOU!”][https://github.com/8values/8values.github.io/blob/master/ideologies.js]
  • Reasons Why I Don’t Write Long Posts Anymore – Vol. I of XIIV
  • Keeping Sanity Part 1b – An much shorter LaTeX Tutorial That Gets Straight to the Point, But Keeps a Long Title

 

 

Back to the Basics: Crayon, wp-LaTex, and vimWiki

Before I forget, I should review some of the basics.

So, this is a blog, and having your own blog requires some maintenance. It’s like owning a house except the servers are hosted in Arizona, the domain name is registered in France, and I guess you’re not owning said house. You’re renting hardware space in someone else’s basement.. Note where your local and remote machines are. Okay, so I need to remember how to bash function. How to bash function? No, how about just a bash alias?

alias alias_name="commandToRun"

while we’re at it

alias maketotaldestroy='sudo halt -p'

but the alias needs to be remembered after reboots

cd ~/
ls -la
vim .bash_aliases

include in file, continue with life.

source ~/.bash_aliases

So with this, instead of memorizing a very long username + host domain I can access my blog with only a few magic words.

alias sshblog='ssh forgettableLongName@ridiculouslyLongRemoteHostName.net'

.. checkmate. I guess we could include the password as an argument but, no. So long as remote and host have authenticated each other before, this ought to be enough.

Now, without needing to activate FTP we can update and modify everything in the blog via command line. Will need WP-CLI. Fortunately the freebsd log files kept track of the commands I issued to it oh so many seasons ago, so simply pressing the up arrow key and holding it for a minute or two sent me to the keystrokes. the magic keywords are simply:

wp help
wp help core
wp core check-update
wp core update
wp core update-db
wp core verify-checksums

wp help plugin
wp plugin update --all
wp plugin uninstall akismet
wp plugin uninstall hello

remove/deactivated unneeded plugins which could become hazardous to your health. For more information these functions have been well documented at http://wp-cli.org/docs/ or simply refer to the man pages

How to syntax on wp?

since we’re going to be typing code here and there, a nice plug-in to have is:
https://wordpress.org/plugins/crayon-syntax-highlighter/

from here we can simply dl to our own machine or even use SSH from the remote machine to dl the file from a selected URL https://downloads.wordpress.org/plugin/crayon-syntax-highlighter.zip and then save it to the remote machine’s plugin directory, then..

via wp-cli
search for “crayon” to get a list of plugins already available through official channels

wp plugin search crayon
wp plugin install crayon-syntax-highlighter
wp plugin activate crayon-syntax-highlighter

So now we have pretty colors that support languages beyond what the regular vanilla wordpress supports. you could also git clone or wget + unzip from https://github.com/aramk/crayon-syntax-highlighter.git to get the same affect, but we’re already using wp-cli to run an update so might as do it from the remote host.

Next order of business: LaTeX.. how to LaTeX?

simply typing in:

$latex i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>$

should produce:

$latex i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right> $

Unfortunately, I won’t get to see it until I preview it on the wordpress had it even worked to begin with. Apparently a viable plugin would need access to a latex server in order to generate some sort of image. It could be a .png and there’s even one that generates .svg vector images, but it pings to some guy’s web basement server and I’d rather not have my blog reliant on whether or not some random guy forgot to pay their electric bill. Of course, there’s always the option to self host a latex server on my own or a remote machine. A search for latex on the plugin menu yields several attempts at doing this.

While searching, I discovered an old .png generator for latex inputs. It seems to be not-so-old and the current method from which wordpress.com uses to render .png images. You can play around with the below URL.

https://s0.wp.com/latex.php?latex=i\hbar\frac{\partial}{\partial+t}\left|\Psi(t)\right>%3DH\left|\Psi(t)\right>\Psi(t hey type stuf in here and get a png)&bg=ffffff&fg=000&s=0

So, there’s a wordpress.org plug-in that utilizes a  similar, if not the exact same generator from wordpress.com. Note the distinction between the .com and .org service. It also has an option to generate from a self hosted server. Humm..

pro: less bandwidth
con: if access to wordpress.com goes down, image rendering capabilities go down with it. This will happen several times a year depending on who’s attacking the DNS.. but if the DNS is down this website will probably be inaccessible as well. Except in Australia. There’s a story to that.

To be reliant on external services.. Sure, to an extent.

wp plugin install wp-latex
wp plugin activate wp-latex

for more details: https://wordpress.org/plugins/wp-latex/faq/

how to vimwiki?

I’ve been reliant on gnote and random .txt files scattered around my drive to write down random things. A friend of mine recommended vimwiki, almost randomly like he had been reading my mind (or had shell access to my laptop).

vim remember.txt
remember to go through the ssh dot files and delete any weird pgp certs you don't recognize
:qw

The vimwiki is more of a plugin than anything, and should be easily installable through pathogen.

You can find the installation instructions here: https://github.com/tpope/vim-pathogen
and for vimwiki: https://vimwiki.github.io/

I shouldn’t need to go through writing the instructions here because the details are literally right there.

What I did need to figure out was that I was expected to make my own index.wiki file inside the ~/vimwiki/ folder. I was surprised when I could “enter” and “backspace” between files joined together by a link. #jawdrop.

:Vimwiki2HTML

creates a folder with a html transaction (along with a .css) of the page you’re on. It doesn’t follow through the nested links though. With maybe about a 100 functions on that help page, it’ll take a while to get acquainted with this program. I think it’s safe to say it has more functionality than what I had been previously using. I’ll play around with this for a few weeks and then decide if I’m better off with it.

What’s next? humm… I have less than 4 days to prep up on my Korean, toy around with some java, and I think they’ll be putting me in something about a “smarter cities” think group. I suspected it was related to the CES hackathon but that’s this weekend. I should probably go to that, but I need some ‘me’ time and me time includes prepping up on my Korean and toying around with some java. Also, my friend tells me I need to get more sunlight. I do.

[edit] Had been invited by some friends to join them at the CES hackathon this weekend, and despite making an attempt to print out my ticket, I just received an e-mail specifying that entrants needed to be registered for the CES portion by 7 days ago. This would be a separate registration process, and they’re only letting the first 450 people in. It’s fine. More ‘me’ time. Also,

convert -density 300 ticket.pdf -fill blue -opaque black ticketout.pdf

will attempt to change all your black pixels into blue ones in case your printer ran out of black ink. Sadly, I also just found out that we have a Kodak that refuses to print if it detects the black is low (or refuses to print black if it detects the color is low). Hardware should not be used like this against the consumer’s interest. Alternatively I could’ve gone to a UPS store or library that opens early to get something printed – mobile ticket barcodes ftw.

On a lighter note, I finally received the schedule for the Ajou workshop on Monday, so it looks like I’m slowly placing things on that to do list.