Thursday, 31 December 2015

Copy paste in terminal via system clipboard in VIM in Fedora 23

The trouble

When you edit a file via vim editor in Fedora 23, then sadly by default you don't have access to the system clipboard. It means that you are not able to copy some text in the editor and then paste it for example to the browser or vice versa.

Luckily this issue has an easy solution.

Test if you need to fix it or not

To test if your vim supports x11 sytem clipboard run
vim --version
I expect that you will see -xterm_clipboard.  Our goal is to make it +xterm_clipboard.

Solution (Redhat/CentOS/Fedora)

sudo dnf install vim-X11
After that you will be able to use vimx command to start vim with xterm_clipboard support.
Try this:
vimx --version
Now you should see the desired +xterm_clipboard.

Test the result

To test it, just open a file in vim, select a text and then go different application where you can paste the text and hit mouse middle button. The selected text should be pasted there.

Tip'n tricks

As an improvement you can add an alias to your .bashrc file to use vimx even when vim command is started. Add this one line to your .bashrc file:
alias vim="vimx"

If you want to find out more about vim and system clipboard check the referred link below.

Source


Wednesday, 23 December 2015

Yakuake terminal global shortcut in Fedora 23 LXDE

Yakuake

Few years ago I felt in love with Yakuake terminal. It's probably because of two main things - at first it's the drop-down feature - you just hit a shortcut and terminal appears/hides. The second one is splitting the screen and seeing several terminals at once.


Yakuake default Open/Retract shortcut is F12, but as I'm a web developer, I use F12 for browser developer toolbar. So for the terminal I started to use F9. (Yes I know that it interfere with debugger shortcut, but I got used to it ;)

Open/Retract shortcut stopped working

Recently I did a fresh install of Fedora 23 LXDE spin and after installation of Yakuake the default F12 wasn't working nor I wasn't able to assign my own global shortcut key (F9).

When I opened the shortcuts settings, selected the global setting for the Open/Retract -> custom -> hit F9  it wasn't assigned. It just changed from "Input ..." to "None" always. I tried also another shortcut but no shortcut was assigned either.

Solution in Openbox window manager

After googling and finding nothing relevant I decided to try different approach.

I had an idea that yakuake command could have a --drop-down parameter or something like that. I started with even more simple method -  just tried to start yakuake command several times. And it worked just as I needed - first yakuake comand started Yakuake in the background, second run of the command opened the terminal and the third hid it, fourth opened it again .... awesome.

So the solution was easy as fedora lxde spin uses the openbox window manager.

Openbox uses simple xml file for configuring global shortcuts. I just added one keybinding for my need.

~.config/openbox/lxde-rc.xml:

    <!-- Keybinding for yakuake dropdown -->
    <keybind key="F9">
      <action name="Execute">
        <command>yakuake</command>
      </action>
    </keybind>

Those settings are loaded during window manager startup therefore I logged out, logged in and tadaaa - problem solved ;)

Sunday, 20 December 2015

Fedora 23 - resolution only 800x600 with Intel Corporation Sky Lake Integrated Graphics (rev 07)

I've bought new laptop ASUS F555UB-DM035T and installed linux Fedora 23.
What surprised me a litte bit was that it started with a basic resolution 800x600 and it wasn't possible to set a better one.

As this notebook has NVIDIA GeForce 940M with Optimus technology, I thought it's caused by that and it will be fixed by Bumblebee installation.

But even after I successfully installed bumblebee the resolution wasn't fixed. At that moment I realized that bumblebee is just for enabling of the discrete Nvidia GPU and not a driver for the graphic adapters. So the problem is probably in a driver for the currently used graphic chip.

I can see that I have this one (when 3D chip is not enabled by bumblebee):
$ lspci | grep VGA 
00:02.0 VGA compatible controller: Intel Corporation Sky Lake Integrated Graphics (rev 07)
Just note that my current kernel is:
$ uname -r 
4.2.7-300.fc23.x86_64
After googling a little bit I find out for example this article with an explanation that Skylake GPU is considered as of "preliminary hardware support" by the Intel DRM kernel driver. And to be able to use it with all resolutions which the graphic card supports you have to start your kernel with i915.preliminary_hw_support=1 parameter.


How to add the kernel boot parameter to the GRUB?

It's written in the article I mentioned, but I will shortly repeat it.

A) Temporary - for test:

Reboot your pc and when Grub menu appears hit "E". There you can add it to the appropriate line:

B) Permannent

At first I tried to use graphic utility grub-customizer, but it didn't work so I went with the command line, which was much more easier when I found the right manual how to do it ;) Editing grub in Fedora really well described here, so I will not repeat it.
Here is just a screenshot so you can see how easy it is ;)


Ok, that's it.

As there are more things which bothers me - touch-pad is not working, wifi is regulary dropping, I have thousands of warnings about hardware recoverable error in the system log (probably connected with the wifi)... I will probably add few more articles when I solve it.

Edit (few days later): no more articles about this notebook:


  • New problem appeared - total freezing of the system - I had to do hard reset (probably after installation of VirtualBox, but I'm not 100% sure it was caused by that)
  • And as I was very sad because of all those incompatibility issues with the linux system I returned the Asus notebook and took Lenovo IdeaPad z51 instead