My Vim Setup #2 (Mappings / Custom shortcuts)
Вставка
- Опубліковано 21 січ 2019
- The wonders of Vim, Bash and Tmux :D
This time we talk about mapping key strokes to commands (i.e. constructing your own awesome and powerful shortcuts for absolutely anything you want) and file modifiers. You can use these shortcuts to e.g. compile your project, run your project, run your tests, or anything you can think of :)
/ christopherokhravi
Dude!! Your last upload was almost 6 months ago.. We need content.. I love your channel man..
twitter.com/chrokh/status/1263076733886124034
Hi, @Christopher Okhravi. Your videos are really having great content and knowledge. Thanks for making videos on vim and terminal use.
1 month since this last video. Is everything ok ?
Not sure why I was so confused about `%:h`. I later realized that I use `%:h` to get the folder of the current file, and ofc I've used `%:r` to get the filename without the extension. Sorry about the confusion! 😊😊
Happens to the best of us. And more importantly, I think is a good thing that you show us your thought process to approach something.
When anyone starts programming with those tutorials that show how easy and straight forward is coding, they get mislead. The reality is you know some things, you lack most of the knowledge to solve the problem and start to try and error until you succeed.
@@PabloAndresDealbera Excellent points Pablo. Thanks. Much appreciated.
Please start series on Domain driven design architecture.
Please use books in a same way how u used in design patterns series.
Can’t believe myself... I finished watching this video and love it! Where is the next one?:)
great videos, can you tell how do you do the settings when making the active buffer have more width than the other buffers ? Thanks
Actually, you will like NeoVIM because it has all VIM features plus it has terminal in itself.
With neovim-remote plugin you can do the following: run first instance of NeoVIM as a server, edit your files. And when needed, open terminal (":terminal" command) and using neovim-remote open files in buffers of the NeoVIM in which you run terminal session. :)
And another useful feature for me (I write instructions, how-to, etc.) is ability of VIM to read from the command line output directly into the opened file. E.g. if I want to put in my MarkDown document basic folder structure of the project. I do from the VIM ":read !tree -d" and output of "tree -d" gets incerted in my document.
It’s been 9 months! I hope you are doing well.
We miss you bro.
Please continue Design Patterns series!
I hope you are doing well because I am new here and I see you didn’t publish videos for 6 months...
Really, really good video. I like the way you are explaining so much. Thank you very much for your efforts.
Solid content! Please start uploading again. Hope everything's well : )
Thank you, Christopher. My brain couldn't grasp the documentation on mappings. You solved it in 15 mins. Subbed too.
Don't stop to make videos. You are amazing!!!
We miss you Christopher!! Please come back! :(
Did you ever try to just monitor the filesystem and build automatically when you save? Just a small script based on inotify independent of vim....
Just want to say that 5:50 seconds you were right. I believe it does do with the return of the command. You can simply test this by running Clear "T" && echo "foobar" which will execute only the error (Usage of clear) and not the foobar, but if you proceed to do it with or it will execute both. Well noted!
Christopher, I wonder if you used i3wm (or other window manager) instead of desktop environment.
You are one of my favorite CS channels! And I do somewhat enjoy your ramblings. If you mapped out everything you would say, you wouldn't be as charismatic.
Your Design Patterns series was great for reviewing the Head First book. After finishing this series, is there any chance you can do another series on another Software Engineering concept?
this is perfect dude, You saved me tons of time. Thank you for doing this .
In the new versions of vim you can Runa terminal inside vim and there's the plugin AsynchRun which executes a command asynchromnously and sends the input of that program to the quickfix
Where are you??
Waiting for your videos ?
Hope you are well.
Great job!!!
You can move line down using :m +1 and up using :m -2, it's easier to map that.
Cool. Thanks! I didn’t know 😊😊 Thanks for sharing and for watching 😊😊
great video, question out of the blue, how do you could manage better all these knowledge, for example saw you trying to remember how || and && work in bash, I'm to start my personal log of situations that could help me in the future (same problems, same solutions)..
Good point! Thank you for sharing! Maybe a public blog would be suitable? I've often read short blog posts from people who in their blog post admit that they made the post so that they would remember whatever they were writing about :) Feel free to post a link to your blog here if you happen to start one! :) Thanks for watching and thanks for sharing your thoughts :)
Great video, more vim please :)
In shell, && and || are short circuited -> en.wikipedia.org/wiki/Short-circuit_evaluation
when you get a false in a AND statement, then no need to evaluate further, it's false.
and when you get a true in a OR statement, then no need to evaluate further, it's true.
You can try it for yourself with:
true && sleep 3
false && sleep 3
true || sleep 3
false || sleep 3
when the command return immediately, then it got short circuited.
Where have you been ? 😭
When are some new Explanations of Software book !!! Where are the videos ! I love you and the design series ! Very amazing !
if your not moving around with arrow keys then how do you move the cursor in insert mode?
if you press j in insert mode it just inserts j into the text
@Rafael Lopes or if you litterally need to just go down/up 1 or 2 lines then you can just go a head and press the arrow keys to move those lines. XD
j j i
seems a like a lot of work for something i can accomplish simple by pressing the down key 2 times
but obviously for large movements i'd escape to normal mode because then it is way shorter just to use the search or other vim shortcuts
You have a tiny head or superlarge hands?
Worth investing my time on this video.
what distro do you use now ?
Curious about this too!
you should probably try to just write :help and read the first page if you want to learn how to read the documentation best. But to be fair I think over a lifetime of using vim you will read the doc for maybe 10 hours, and 5 if you are efficient, so not a big time save
How to configure the keys map with the or ?
More vim videos please ! :)
22:25 🤣️ 🤣️ 🤣️
Can you make a video about your current theme, font-family, color-scheme, font-size, etc.?
I'll bring up how to configure these things in a future video in this series (and will then in passing mention my settings). But the short story is that I use chriskempson's base16 for whatever terminal I'm using (iTerm on mac and gnome terminal on gnu/linux) and then chriskempson's base16-vim for vim. I then use AuditeMarlow's base16-manager to easily switch between colorschemes (since I tend to switch to light themes sometimes during the day). I'm pretty sure I'm using the default font family, and font size I just adjust on the fly depending on daily mood :) For themes I'm currently using either materia or dracula :)
Thanks 👍
The best notification ..
Thanks! Much appreciated :D :D Thank you for watching :)
Ever since you stop uploading new videos I've lost my passion to learn new stuff please come back !
Bang!
Hey Chris! Where have you gone? What you up to now?
Hey man! It's been over a year now since we last heard from you! Maybe you won the lottery and took off? If so, atleast let us know you're alive and well! In any case, all of us hope you are doing well!
Ty.
How to use hjkl in comand mode?
is vim works by all set up in Windows ? yo
I want you to upload video about DDD!
|| only run the command if the previous commands fails.
You are looking for ; which runs the next command after the last command. If you don't have any special configuration, like always halt on error.
Ah dang it. Ofc! Sorry about that(!) but thank you very much for pointing it out! :D Thank you for watching!
Where's part 3?
What happened to you?
Yo are you Swedish? BTW loved the video, I'm a fucking normie who previously opened a new terminal, cd to the directory and typed the command, so this really enlightened me.
Ape
New videos please !! regards
Audio needs improvement, agreed?
I think it's ok. Though I really liked the bigger font, watching on mobile and...
It is OK , but there is space for improvement
I noticed there has been almost no uploads for the last 10 months, but after watching your design pattern series, I fully intended to watch more. Are you still creating content? I'd like to say thanks btw for your incredible series back in 2017, really helped me out this semester.
where is the dotfiles kido
honestly, the video could have been shorter.
Dead
It's a shame that we missed him.(I hope he's doing well )
map
map
map
map
works in insert mode also. I dont want this
You can place i before each map to also do it in insert mode:
imap
imap
imap
imap
Vim is only useful for writing short codes nothing else. When ur code base size increases the power of vim is nothing.
I happily use Vim regardless of code base size (and don’t want to use other IDEs or editors) but thank you for sharing your opinion 😊 and for watching 😊😊
@@ChristopherOkhravi without intellisense how can u work? what codebase u have worked bro, is it a language like java, c++ or like html,
I appreciate the tutoring but I think you lost yourself out of the subject a little too much.
Better to spend 20 minutes reading bash help ('man bash') than watching someone floundering around making mistakes because he did not read the man pages himself first.
"[bash command 1] && [cmd 2]" means "do cmd 2 if cmd 1 returns a success code.
"[bash command 1] || [cmd 2]" means "do cmd 2 if cmd 1 returns a fail code.
"[bash command 1] ; [cmd 2]" means "do cmd 2 whether cmd 1 returns a success or a fail code. Chris thinks this is what || does, and that is why half this video is rubbish.
RTFM Christopher, especially before giving tens of thousands of people incorrect information!
This guy talks too much
what happened to you?