From 517bc5f58725e3c7286767dfab445d6a186fe670 Mon Sep 17 00:00:00 2001 From: mitchell Date: Thu, 28 Oct 2021 12:21:25 -0400 Subject: [PATCH] Adopt use of NNN instead of NerdTree and add some aliases --- .config/fish/functions/btre.fish | 1 + .config/fish/functions/define_aliases.fish | 1 + .config/fish/functions/n.fish | 36 +++++++++++ .vimrc | 71 ++++++++++++---------- provision_linux | 1 + 5 files changed, 77 insertions(+), 33 deletions(-) create mode 100644 .config/fish/functions/n.fish diff --git a/.config/fish/functions/btre.fish b/.config/fish/functions/btre.fish index df438d4..cfe539d 100644 --- a/.config/fish/functions/btre.fish +++ b/.config/fish/functions/btre.fish @@ -16,6 +16,7 @@ function btre -a device -d 'Reconnect to a known bluetooth device' bluetoothctl pair $devices[$index] bluetoothctl trust $devices[$index] bluetoothctl connect $devices[$index] + sleep 2 pkill bluetoothctl end diff --git a/.config/fish/functions/define_aliases.fish b/.config/fish/functions/define_aliases.fish index c400a5e..cae0c96 100644 --- a/.config/fish/functions/define_aliases.fish +++ b/.config/fish/functions/define_aliases.fish @@ -2,6 +2,7 @@ function define_aliases -a uname -d 'Defines aliases for commonly used commands' alias rcp 'rsync -aP' alias dm 'docker-machine' alias v 'nvim +FZF' + alias j 'joplin' alias vg 'vagrant' alias tf 'terraform' alias tocb 'xclip -in -selection clipboard' diff --git a/.config/fish/functions/n.fish b/.config/fish/functions/n.fish new file mode 100644 index 0000000..758fcf0 --- /dev/null +++ b/.config/fish/functions/n.fish @@ -0,0 +1,36 @@ +# Rename this file to match the name of the function +# e.g. ~/.config/fish/functions/n.fish +# or, add the lines to the 'config.fish' file. + +function n --wraps nnn --description 'support nnn quit and change directory' + # Block nesting of nnn in subshells + if test -n "$NNNLVL" + if [ (expr $NNNLVL + 0) -ge 1 ] + echo "nnn is already running" + return + end + end + + # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) + # To cd on quit only on ^G, remove the "-x" as in: + # set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd" + # NOTE: NNN_TMPFILE is fixed, should not be modified + if test -n "$XDG_CONFIG_HOME" + set -x NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd" + else + set -x NNN_TMPFILE "$HOME/.config/nnn/.lastd" + end + + # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn + # stty start undef + # stty stop undef + # stty lwrap undef + # stty lnext undef + + nnn -de $argv + + if test -e $NNN_TMPFILE + source $NNN_TMPFILE + rm $NNN_TMPFILE + end +end diff --git a/.vimrc b/.vimrc index 88a72d7..1727dfc 100644 --- a/.vimrc +++ b/.vimrc @@ -3,49 +3,50 @@ call plug#begin('~/.vim/plugged') " Contains lots of sensible configurations, which I have in turn omitted from this file Plug 'tpope/vim-sensible' -" Always enabled, non-language plugins Plug 'tpope/vim-eunuch' Plug 'tpope/vim-surround' Plug 'tpope/vim-endwise' -Plug 'w0rp/ale' -Plug 'morhetz/gruvbox' Plug 'itchyny/lightline.vim' Plug 'edkolev/tmuxline.vim' Plug 'airblade/vim-gitgutter' Plug 'vimwiki/vimwiki' Plug 'junegunn/goyo.vim' Plug 'junegunn/fzf' -Plug 'autozimu/LanguageClient-neovim', { - \ 'branch': 'next', - \ 'do': 'bash install.sh', - \ } -Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } - - -" Conditionally loaded plugins -Plug 'tpope/vim-fugitive', { 'on': ['G', 'Git'], 'for': 'gitcommit' } -Plug 'mileszs/ack.vim', { 'on': 'Ack' } -Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'reedes/vim-pencil', { 'on': ['HardPencil', 'SoftPencil'] } -Plug 'junegunn/limelight.vim', { 'on': 'Limelight' } -" Language specific plugins -Plug 'dart-lang/dart-vim-plugin' -Plug 'elixir-editors/vim-elixir' -Plug 'georgewitteman/vim-fish' -Plug 'fatih/vim-go' -Plug 'jparise/vim-graphql' -Plug 'pangloss/vim-javascript' -Plug 'vim-ruby/vim-ruby' -Plug 'cespare/vim-toml' -Plug 'OmniSharp/omnisharp-vim' -Plug 'HerringtonDarkholme/yats.vim' -Plug 'MaxMEllon/vim-jsx-pretty' -Plug 'ionide/Ionide-vim' -Plug 'b4b4r07/vim-hcl' -Plug 'hashivim/vim-terraform' -Plug 'PProvost/vim-ps1' -Plug 'vmchale/dhall-vim' +if !exists('g:vscode') + Plug 'morhetz/gruvbox' + Plug 'w0rp/ale' + Plug 'autozimu/LanguageClient-neovim', { + \ 'branch': 'next', + \ 'do': 'bash install.sh', + \ } + Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } + + Plug 'tpope/vim-fugitive', { 'on': ['G', 'Git'], 'for': 'gitcommit' } + Plug 'mileszs/ack.vim', { 'on': 'Ack' } + Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } + Plug 'mcchrish/nnn.vim', { 'on': 'NnnPicker' } + Plug 'junegunn/limelight.vim', { 'on': 'Limelight' } + + " Language specific plugins + Plug 'dart-lang/dart-vim-plugin' + Plug 'elixir-editors/vim-elixir' + Plug 'georgewitteman/vim-fish' + Plug 'fatih/vim-go' + Plug 'jparise/vim-graphql' + Plug 'pangloss/vim-javascript' + Plug 'vim-ruby/vim-ruby' + Plug 'cespare/vim-toml' + Plug 'OmniSharp/omnisharp-vim' + Plug 'HerringtonDarkholme/yats.vim' + Plug 'MaxMEllon/vim-jsx-pretty' + Plug 'ionide/Ionide-vim' + Plug 'b4b4r07/vim-hcl' + Plug 'hashivim/vim-terraform' + Plug 'PProvost/vim-ps1' + Plug 'vmchale/dhall-vim' +endif call plug#end() @@ -81,7 +82,7 @@ nmap c (lcn-code-lens-action) nmap d (lcn-explain-error) nnoremap ls :LanguageClientStop nnoremap ll :LanguageClientStart -nnoremap n :NERDTreeToggle +nnoremap n :NnnPicker nnoremap p :FZF nnoremap a :Ack nnoremap we :VimwikiAll2HTML @@ -109,6 +110,7 @@ let g:LanguageClient_serverCommands = { \ 'typescript': ['typescript-language-server', '--stdio'], \ 'typescript.tsx': ['typescript-language-server', '--stdio'], \ 'elixir': ['~/code/elixir-lsp/elixir-ls/bin/language_server.sh'], + \ 'eelixir': ['~/code/elixir-lsp/elixir-ls/bin/language_server.sh'], \ 'go': ['gopls'], \ 'fsharp': ['dotnet', '~/code/fsprojects/fsharp-language-server/bin/FSharpLanguageServer.dll'], \ 'dhall': ['dhall-lsp-server'], @@ -169,6 +171,9 @@ let g:pencil#map#suspend_af = 'K' let g:vimwiki_list = [{'path': expand('~/.wiki/')}] +let g:nnn#layout = {'left': '~20%'} +let g:nnn#command = 'nnn -eHo' + augroup ft_jsx au! autocmd BufNewFile,BufRead *.jsx set filetype=javascript.jsx diff --git a/provision_linux b/provision_linux index 9e50096..ec25bd5 100755 --- a/provision_linux +++ b/provision_linux @@ -62,6 +62,7 @@ function provision_terminal_env -d 'Install base terminal utilities and sync con curl \ kitty-terminfo \ fzf \ + nnn set -l arch_pkgs \ $base_pkgs \