How Set Neovim startup directory to Desktop in windows? - lua

I'm using Astro vim distro with neovide. every time I launch neovide / neovim-qt it launches in the directory it's installed on!
OS: windows 10
[Astrovim starting location][1]
[using windows shortcut properties to set start in location][2]
[1]: https://i.stack.imgur.com/ZvXfp.png
[2]: https://i.stack.imgur.com/IEl4N.png
is there a way to set startup location in options.lua ?

Try following code in your configuration file, it make use of vim\neovim autocommands feature:
local os = require("os")
local path_to_desktop = os.getenv("USERPROFILE") .. "\\Desktop"
local vim_enter_group = vim.api.nvim_create_augroup("vim_enter_group", { clear = true })
vim.api.nvim_create_autocmd(
{"VimEnter"},
{ pattern = "*", command = "cd " .. path_to_desktop, group = vim_enter_group }
)
nvim_create_autocmd and nvim_create_group are described in neovim docs. Use :h nvim_create_autocmdto find out more.

Related

xen linux + baremetal cortex A53

I am trying to run Linux (buildroot) + baremetal app on Xen.
Xen boots great and buildroot is ok on the first CPU.
My problem is the baremetal application.
The baremetal app is generated by Vitis (my A53 is in the FPGA).
This is the simplest example application : just an hello world and exit.
I am able to boot directly on this app using the jtag but when I try to run the baremetal app in Xen the app just hand and doesn't print anything.
My configurations :
FILE : xen.cfg
name = "test"
kernel = "/opt/baremetal_app.bin"
memory = 8
vcpus = 1
cpus = [1]
iomem = [ "0xff010,1" ] # UART1
Xen command line :
console=dtuart dtuart=serial0 dom0_mem=1G bootscrub=0 maxcpus=1 timer_slop=0
dom0 command line :
console=hvc0 earlycon=xen earlyprintk=xen maxcpus=1 clk_ignore_unused root=/dev/mmcblk0p2
Vitis is configured to include the hypervisor_guest the in binary.
I already tried to change the psu_ddr_0_MEM_0 to 0x40000000, len 100000.
When I run the command "xl create xen.cfg", the system print "Parsing config from xen.cfg" and returns. I see my app test in "xl list".
The uart1 doesn't print anything and the "xl console test" neither.
With "xl top" my app test seems to use 100% of the cpu.
Any idea ?

FZF and NeoVim how to get files list

I try to use neovim with fzf plugins. Part of my init.lua is
-- Plugin imstallation section
local install_path = fn.stdpath('data')..'/site/pack/paqs/opt/paq-nvim'
if fn.empty(fn.glob(install_path)) > 0 then
cmd('!git clone --depth 1 https://github.com/savq/paq-nvim.git '..install_path)
end
-- Load the plugin manager
cmd 'packadd paq-nvim'
-- Set the short hand
local plug = require('paq-nvim').paq
-- Make paq manage it self
plug {'savq/paq-nvim', opt=true}
plug {'scrooloose/nerdtree', opt=true}
plug {'vim-airline/vim-airline', opt=true}
plug {'vijaymarupudi/nvim-fzf', opt=false}
plug {'ibhagwan/fzf-lua', opt=false}
require('paq-nvim').install()
require('paq-nvim').clean()
When I try to use command FzfLua files I observe message
fzf error 2 : unknown option: --headless
I work under Windows 10 and I use lua plugins : fzf-lua and nvim-fzf
fzf binary was installed and reachable
I cannot understand why rzr run with this strange option
What I did wrong?
Fzf-lua uses nvim-fzf actions for previews (and other functions) which calls lua functions by running neovim —headless … <lua function id>.
It seems that your neovim version does not support the headless option, I know of other users running fzf-lua on WSL, try with the official 0.5.1 appimage

How can I change the UUID of my nixos OS partition, and update the bootloader?

So essentially I've got an exact clone of my partition (I've changed the UUID though), and I'd now like to change over the bootloader to load the new partition.
What I tried:
I naively (while booted / running on the original partition) tried to modify the hardware-configuration.nix (on the original partition) with the new UUID and then tried to:
sudo nixos-rebuild switch
sudo nixos-rebuild boot
Both which fails** at the point of mounting the drives (I think).
updating GRUB 2 menu...
lsblk: /dev/mapper/no*[0-9]: not a block device
lsblk: /dev/mapper/raid*[0-9]: not a block device
lsblk: /dev/mapper/disks*[0-9]: not a block device
Found Arch Linux on /dev/sdb3
Also, I'd assume I'd possibly need to mount this new partition somewhere (unless, this isn't required to actually boot into it (after a reboot)?).
** Actually although it appears to 'fail', when I reboot, and select the usual nixos grub entry, I see the following (the UUID mentioned is the UUID that does exist - and it's the new partition):
Worst case scenario, it seems I'd be able to use a nixos live USB to mount the new partition to /mnt and then just follow the usual nixos-install (which has worked in the past - with only the /etc/nixos directory present though)?
Firstly, get the system in working order again by changing the UUID back in hardware-configuration.nix and making sure it boots OK.
Next, change the UUID in hardware-configuration.nix, like you have done before, but this time run sudo nixos-rebuild boot.
When you reboot you'll have a new entry in your systemd-boot or GRUB2 menu. The new entry will boot NixOS from the new partition.
I tried using the nixos-install route.
I had issues with my existing hardware-configuration.nix it seems as I ran into the exact same issue waiting for device....
Finally I ran nixos-generate-config --root /mnt which generated a new config which had the following differences:
diff -u nixos.backup/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
--- nixos.backup/hardware-configuration.nix 2018-11-22 20:18:01.361647120 +0000
+++ /etc/nixos/hardware-configuration.nix 2018-11-22 20:18:41.818644420 +0000
## -8,8 +8,8 ##
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
- boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
- boot.kernelModules = [ "kvm-intel" ];
+ boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
+ boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
## -20,6 +20,4 ##
swapDevices = [ ];
nix.maxJobs = lib.mkDefault 4;
- powerManagement.cpuFreqGovernor = "powersave";
}
-
So probably the nvme bit. Also add that I had kvm-intel as my CPU stayed the same (which is an AMD).

Invoking shell scripts on Windows under MSYS using Command

I am trying to invoke commands in Rust (1.0 beta 3) on Windows 7 in an MSYS2 environment, but I cannot understand how to do it.
Suppose that you have this very simple script called myls in your home folder:
#!/bin/bash
ls
And now create a simple program in Rust that calls the script:
use std::process::Command;
use std::path::Path;
fn main()
{
let path_linux_style = Path::new("~/myls").to_str().unwrap();
let path_win_style = Path::new("C:\\msys64\\home\\yourname\\myls").to_str().unwrap();
let out_linux = Command::new(path_linux_style).output();
let out_win = Command::new(path_win_style).output();
match out_linux
{
Ok(_) => println!("Linux path is working!"),
Err(e) => println!("Linux path is not working: {}", e)
}
match out_win
{
Ok(_) => println!("Win path is working!"),
Err(e) => println!("Win path is not working: {}", e)
}
}
Now, if you try to execute it, you will get the following output:
Linux path is not working: The system cannot find the file specified.
(os error 2)
Win path is not working: %1 is not a valid Win32 application.
(os error 193)
So I am not able to invoke any command in MSYS environment.
How can I solve it?
EDIT:
I noticed that if I invoke an executable, the problem doesn't happen, so it seems to be related to invocation of bash script. Anyway, it's quite annoying since it makes compiling projects depending on external C/C++ code (that need to launch configure script) tricky to get to work.
The Windows example doesn't work because Windows isn't a Unix. On Unix-like systems, the #! at the beginning of a script is recognized, and it invokes the executable at the given path as the interpreter. Windows doesn't have this behavior; and even if it did, it wouldn't recognize the path name to the /bin/bash, as that path name is one that msys2 emulates, it is not a native path name.
Instead, you can explicitly execute the script you want using the msys2 shell, by doing something like the following (alter the path as appropriate, I have msys32 installed since it's a 32 bit VM)
let out_win = Command::new("C:\\msys32\\usr\\bin\\sh.exe")
.arg("-c")
.arg(path_win_style)
.output();

Connecting to Active Directory

I have the following script from a book. When I try to run this, I get nothing output to the screen.
$objADSI = [adsi]""
$domain = $objADSI.distinguishedname
$userContainer = [adsi]("LDAP://cn=users," + $domain)
foreach($child in $userContainer) {
Write-Host $child.samaccountname
}
If I echo $userContainer, I get:
distinguishedName : {CN=Users,DC=company,DC=co,DC=uk}
Path : LDAP://cn=users,DC=company,DC=co,DC=uk
Do I need to run winrm quickconfig on the Active Directory server? The Active Directory server is running Windows Server 2003 standard edition. Or am I getting nothing returned for some other reason?
Change your foreach like this:
foreach($child in $userContainer.children)

Resources