Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewvcz-0004Wu-Qa for pgsql-general@arkaria.postgresql.org; Fri, 16 Mar 2018 20:07:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ewvcy-00040L-89 for pgsql-general@arkaria.postgresql.org; Fri, 16 Mar 2018 20:07:00 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewvcx-00040C-TP for pgsql-general@lists.postgresql.org; Fri, 16 Mar 2018 20:07:00 +0000 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ewvcv-0005FV-9E for pgsql-general@lists.postgresql.org; Fri, 16 Mar 2018 20:06:58 +0000 Received: by mail-pf0-x244.google.com with SMTP id y186so4576149pfb.2 for ; Fri, 16 Mar 2018 13:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=B7KpDafpsnIULFgQteCRWiMPjqJSiPUzrBiFUXNlgEY=; b=R3IChb9+/1apyPyKs8JTq1v9RoYtCv2tTV9DgvSoZlKDNPrNb6oKY4Xw9fZmEQg9pp hy7pMjYLlV0h/MhLPpKNptLY8o3NiovNV3ZxAhvW0p0OHR7Lz3IwF1W3TXtJUQW5LY6M gPIEYesrkjY1/+V0E1tru1BV+l6sU+jTCjPc5vrnXlKiuKt3kMOXmofeP5arMYKehv+H CUHUNBYDI6g9xvUUwzAbHUIBRfo5dW+sUGlXslZFY+VDo8MZiovLO3h/vMvF5ZTCTQHh o88i3lEHu5r7yXE0TNNaas4I/wKUiccQ60IVWudHY0fi/mbfcxqMxY/AuL5gwtPBJGiX qMSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=B7KpDafpsnIULFgQteCRWiMPjqJSiPUzrBiFUXNlgEY=; b=O1TzyOVKY87DiOcgpJ/Oq+ht2WI/7v3FTXfA9K5XeSQeWBhUyHv2UJ67AiPJOGYsJN k6kioimdQQo8RgZTjpOW98K/9LQctnKrVQplsuIioOfz4byUlDfK2aGaQqh6wtq5n3zw lqdyz4m/wJlC2LrDiuVrqeXF4fb/af0ODign2Igo4prGrvcISYuBokHKJiJQa040D5mN KLzL3Kl7jNouq/SONoMg9CJQf0ew/5CbiyRTHTWxBHY7YcC03Nz1/DbpsN9XKG/TotOX JViTqctcX+Go26kGpYtXzCAta1z+9QNrGS/L40SRlqO1NkyzGh92S+8KXnMvE0j07sWn Devw== X-Gm-Message-State: AElRT7FpyAqMg2vhd7np8M3kvHnDAK+F/I+vQ5q+IMrGCgWntB7SICG/ TZ26M4oMqxugJ4gEhaKVt3LVGJOF X-Google-Smtp-Source: AG47ELumWynNFeWYE+9ZZS+LrUJYB+9zhg6Y/qzyvfLAidolwxm1DWUJUp1Vlaf4HXS/YAINcJAq+w== X-Received: by 10.99.168.68 with SMTP id i4mr2415029pgp.420.1521230815819; Fri, 16 Mar 2018 13:06:55 -0700 (PDT) Received: from localhost.localdomain ([205.250.196.230]) by smtp.gmail.com with ESMTPSA id d12sm15788894pfn.42.2018.03.16.13.06.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Mar 2018 13:06:54 -0700 (PDT) From: Victoria X-Google-Original-From: Victoria Date: Fri, 16 Mar 2018 13:06:54 -0700 To: "pgsql-general@lists.postgresql.org" Cc: Victorias.Linux@gmail.com Subject: Re: Nvim as external editor in psql as Postgres root user - .vimrc (environment?) issue Message-ID: <20180316130654.650599b5@gmail.com> In-Reply-To: <20180316110517.221f9c7f@gmail.com> References: <20180316104746.1e23e682@gmail.com> <423630eb-637d-8158-3325-ee036910b2c6@aklaver.com> <20180316110517.221f9c7f@gmail.com> Reply-To: Victorias.Linux@gmail.com X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ok, here is a clumsy solution. I have this entry in my /home/victoria/.psqlrc file, \setenv EDITOR "/usr/bin/nvim" As you see below, I symlink to that file, from postgres. [victoria@victoria ~]$ sudo -u postgres -i [postgres@victoria ~]$ pwd /var/lib/postgres [postgres@victoria ~]$ ls -la total 108 drwxrwxr-x 6 postgres victoria 4096 Mar 16 12:48 . drwxr-xr-x 33 root root 4096 Mar 16 00:00 .. -rw------- 1 postgres postgres 385 Mar 16 12:49 .bash_history -rwxr-xr-x 1 root root 806 Mar 16 12:41 .bashrc drwx------ 2 postgres postgres 4096 Mar 16 12:23 .cache drwxrwxr-x 2 postgres victoria 4096 Feb 23 13:26 data drwx------ 3 postgres postgres 4096 Mar 16 12:12 .local lrwxrwxrwx 1 postgres victoria 62 Feb 23 15:10 .psql_history-postgres -> /mnt/Vancouver/Programming/RDB/postgres/postgres/.psql_history lrwxrwxrwx 1 postgres victoria 22 Feb 23 14:59 .psqlrc -> /home/victoria/.psqlrc drwxr-xr-x 2 postgres postgres 4096 Mar 16 12:38 .vim -rw------- 1 postgres postgres 895 Mar 16 12:48 .viminfo -rw-r--r-- 1 postgres postgres 68234 Mar 16 12:47 .vimrc ## NOTE: .bashrc and .vimrc are edited COPIES (not symlinks) of /home/victoria/{.bashrc | .vimrc} [postgres@victoria ~]$ cat /var/lib/postgres/.bashrc export PSQL_EDITOR="/usr/bin/nvim -u /var/lib/postgres/.vimrc" ## "/var/lib/postgres/.vimrc" is the same as "/home/victoria/.vimrc" EXCEPT ## that I commented out line 77, "execute pathogen#infect(), as that was ## throwing an error when starting nvim (Neovim) as the psql \e external editor. ## Important (slight annoyance: need to load that "postgres" .bashrc file: [postgres@victoria ~]$ exec bash [postgres@victoria ~]$ psql psql (10.2) Type "help" for help. [postgres]# \e ## can edit in Neovim, with ~/.vimrc settings, preferences, customizations ... [postgres]# \q [postgres@victoria ~]$ exit exit [victoria@victoria ~]$ I wasn't able to automatically run the "exec bash" command after starting postgres, hence the need to manually run it in the postgres shell, prior to launching psql. ==============================================================================