From 4b8de442aba8a757bc91df13531540d1765e873f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Wed, 19 May 2021 00:22:23 +0200 Subject: [PATCH] Added debugger into neovim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Woźniak --- .config/nvim/init.vim | 3 +++ .local/bin/debugger | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100755 .local/bin/debugger diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 2cb58f6..9e98cc4 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -206,6 +206,9 @@ cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! map :setlocal spell! spelllang=en_gb map :setlocal spell! spelllang=pl +" debugger +map :w:terminal ~/.local/bin/debugger '%:p' + " latex let g:tex_flavor = "latex" autocmd BufWritePost *.tex silent! execute "!pdflatex --shell-escape -synctex=1 -interaction=nonstopmode % > /dev/null " | redraw! diff --git a/.local/bin/debugger b/.local/bin/debugger new file mode 100755 index 0000000..ea584a8 --- /dev/null +++ b/.local/bin/debugger @@ -0,0 +1,12 @@ +#!/bin/bash + +FILE="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)" + +if [ -f "$FILE" ] ; then + case "$FILE" in + *.py) python3 -m pdb "$FILE" ;; + *.sh) /bin/bash -ex "$FILE" ;; + *) printf "File \"%s\" not debugger found.\\n" "$FILE" + esac + printf "File \"%s\" not found.\\n" "$FILE" +fi