diff options
author | jakobst1n <jakob.stendahl@outlook.com> | 2024-05-22 08:05:23 +0200 |
---|---|---|
committer | jakobst1n <jakob.stendahl@outlook.com> | 2024-05-22 08:05:23 +0200 |
commit | f5e8a5c13c10dd93d614dea2530877ef48071a22 (patch) | |
tree | d9119cd317eb235fdbb5229db71ed45b8d833ba3 | |
parent | eaf4ca6b91de4e3efceb092a17b97503cdaa05cd (diff) | |
download | dotfiles-f5e8a5c13c10dd93d614dea2530877ef48071a22.tar.gz dotfiles-f5e8a5c13c10dd93d614dea2530877ef48071a22.zip |
Update neovim, tweak some things
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | Common/nvim/lua/basic.lua | 16 | ||||
-rwxr-xr-x | Common/nvim/lua/helper_functions.lua | 17 | ||||
-rw-r--r-- | Common/nvim/lua/lsp-conf.lua | 4 | ||||
-rwxr-xr-x | Common/nvim/lua/plugins.lua | 40 | ||||
-rw-r--r-- | Makefile.m4 | 2 | ||||
-rw-r--r-- | bin/autoclean.sh.m4 | 8 | ||||
-rwxr-xr-x | bin/cd-archive | 2 | ||||
-rw-r--r-- | linux/tmux.conf.m4 | 4 |
9 files changed, 39 insertions, 55 deletions
@@ -99,3 +99,4 @@ Common/newsboat/history.cmdline Common/newsboat/urls bin/pingme +bin/autoclean.sh diff --git a/Common/nvim/lua/basic.lua b/Common/nvim/lua/basic.lua index f5bf3a2..cb36189 100755 --- a/Common/nvim/lua/basic.lua +++ b/Common/nvim/lua/basic.lua @@ -18,22 +18,22 @@ vim.opt.softtabstop = 4 vim.api.nvim_set_keymap('n', '<leader><cr>', ':noh<cr>', { noremap = true, silent = true }) -- Tab commands -vim.api.nvim_set_keymap('n', '<leader>tn', ':tabnext<cr>', { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '<leader>tc', ':tabnew<cr>', { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '<leader>tx', ':tabclose<cr>', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '<leader>tp', ':tabprevious<cr>', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '<leader>tn', ':tabnext<cr>', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '<leader>tc', ':tabnew<cr>', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '<leader>tx', ':tabclose<cr>', { noremap = true, silent = true }) --- Return to last edit position when opening files (You want this!) +-- Return to last edit position when opening files vim.cmd [[ au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]] -- Colorscheme -vim.cmd [[ colorscheme default ]] -vim.opt.background = "dark" -vim.opt.termguicolors = true +vim.cmd [[ colorscheme vim ]] +vim.opt.background = "light" -- No idea why, preview in fzf does at least work extremely porly without this vim.cmd [[ let $BAT_THEME = 'gruvbox-light' ]] -- Show colour column vim.opt.colorcolumn = '120' -vim.api.nvim_set_hl(0, "ColorColumn", { ctermbg = "lightgrey", bg = "#363636" }) +vim.api.nvim_set_hl(0, "ColorColumn", { ctermbg = "lightgrey", bg = "#eae7da" }) diff --git a/Common/nvim/lua/helper_functions.lua b/Common/nvim/lua/helper_functions.lua index 5889d5b..88eeb68 100755 --- a/Common/nvim/lua/helper_functions.lua +++ b/Common/nvim/lua/helper_functions.lua @@ -1,3 +1,20 @@ +-- Load local configuration +-- For me this is usually something like +-- let g:vimwiki_list = [ +-- \ {'name': 'I45', 'syntax': 'markdown', 'ext': 'md', 'auto_toc': 1, +-- \ 'path': '~/_library/I45/', +-- \ 'nested_syntaxes': {'python': 'python', 'sql': 'sql', 'ioql': 'ioql'}}, +-- \ {'name': 'P01', 'syntax': 'markdown', 'ext': 'md', 'auto_toc': 1, +-- \ 'path': '~/_library/', +-- \ } +-- \] +-- let g:db = "mysql://user@db001" +vim.cmd [[ +if !empty(glob("~/.env.vim")) + source ~/.env.vim +endif +]] + -- Convenient sudo saving of file vim.api.nvim_create_user_command( 'W', 'w !sudo tee % > /dev/null', diff --git a/Common/nvim/lua/lsp-conf.lua b/Common/nvim/lua/lsp-conf.lua index d80eb3f..2c7463b 100644 --- a/Common/nvim/lua/lsp-conf.lua +++ b/Common/nvim/lua/lsp-conf.lua @@ -61,9 +61,6 @@ vim.opt.signcolumn = 'yes' -- Remove background in SignColumn, looks odd without this vim.api.nvim_set_hl(0, "SignColumn", {link = "LineNr"}) -vim.keymap.set('n', '<leader>d', vim.diagnostic.open_float) -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next) vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist) vim.api.nvim_create_autocmd('LspAttach', { @@ -75,7 +72,6 @@ vim.api.nvim_create_autocmd('LspAttach', { local opts = { buffer = ev.buf } vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts) vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts) diff --git a/Common/nvim/lua/plugins.lua b/Common/nvim/lua/plugins.lua index 67bd4d1..1faf832 100755 --- a/Common/nvim/lua/plugins.lua +++ b/Common/nvim/lua/plugins.lua @@ -90,57 +90,19 @@ return require('packer').startup(function(use) nmap <leader>dbb <Plug>(DBExeLine) autocmd FileType dbout setlocal nofoldenable - - if !empty(glob("~/.env.vim")) - source ~/.env.vim - endif ]] end, } -- Useful for wide screens use { - 'smithbm2316/centerpad.nvim' + 'junegunn/goyo.vim' } -- VimWiki stuff use { 'vimwiki/vimwiki', config = function () - vim.g.vimwiki_list = { - { - path = '~/Nextcloud/2-Områder/204-profesjonelt/204.06-infomedia/204.06.AA-wiki', - syntax = 'markdown', - ext = 'md', - name = 'I45', - auto_toc = 1, - diary_frequency = 'daily', - nested_syntaxes = { - python = 'python', - sql = 'sql', - }, - }, - { - path = '~/Nextcloud/1-Prosjekter/101-masteroppgave/101.02-quick-notes', - syntax = 'markdown', - ext = 'md', - name = 'P101', - auto_toc = 1, - nested_syntaxes = { - python = 'python', - sql = 'sql', - }, - }, - { - path = '~/Nextcloud/', - syntax = 'markdown', - ext = 'md', - name = 'P01', - --nested_syntaxes = { - -- python = 'python', - --}, - }, - } vim.g.vimwiki_global_ext = 0 vim.g.vimwiki_auto_header = 1 vim.g.vimwiki_links_space_char = '_' diff --git a/Makefile.m4 b/Makefile.m4 index f108093..aef3475 100644 --- a/Makefile.m4 +++ b/Makefile.m4 @@ -177,7 +177,7 @@ $(HOME_DIR)/.config/qtile/config.py: linux/qtile/config/config.py m4_ifelse(DT_NEOVIM, `yes', `m4_dnl /usr/local/bin/nvim: git clone https://github.com/neovim/neovim /tmp/neovim - git -C /tmp/neovim checkout tags/v0.9.5 + git -C /tmp/neovim checkout tags/v0.9.0 (cd /tmp/neovim && sudo make install) $(HOME_DIR)/.config/nvim/: /usr/local/bin/nvim diff --git a/bin/autoclean.sh.m4 b/bin/autoclean.sh.m4 new file mode 100644 index 0000000..7a24436 --- /dev/null +++ b/bin/autoclean.sh.m4 @@ -0,0 +1,8 @@ +#!/bin/bash + +echo "[$(date)] Running cleaning routine" +set -o pipefail +set -x + +max_age_days=5 +find "DT_HOME_DIRECTORY/Downloads/" -mtime +${max_age_days} -delete diff --git a/bin/cd-archive b/bin/cd-archive index ff152bd..99b0c79 100755 --- a/bin/cd-archive +++ b/bin/cd-archive @@ -1,5 +1,5 @@ #!/bin/bash -ARCHIVE="${HOME}/Nextcloud" +ARCHIVE="${HOME}/_library" D1=$(find "${ARCHIVE}" -maxdepth 1 -type d -regextype posix-extended -regex "${ARCHIVE}/[0-9]-.*") D2=$(find "${ARCHIVE}" -maxdepth 2 -type d -regextype posix-extended -regex "${ARCHIVE}/[0-9]+-[^/]+/[0-9]{3}-.*") diff --git a/linux/tmux.conf.m4 b/linux/tmux.conf.m4 index 11480ab..2e496b9 100644 --- a/linux/tmux.conf.m4 +++ b/linux/tmux.conf.m4 @@ -33,7 +33,7 @@ m4_ifelse(DT_DOTFILES_TYPE, {local}, {m4_dnl bind-key S send-keys "DT_GIT_USER <DT_GIT_EMAIL>" bind -n M-w display-popup -E "nvim -c VimwikiIndex -c Calendar -c 'wincmd p'" bind -n M-C-w display-popup -E "nvim -c VimwikiMakeDiaryNote -c Calendar -c 'wincmd p' -c 'call append(1, strftime(\"- **%T** - **\"))' -c 'call append(2, \"\")' -c 'execute \"normal! 2GA\"'" -bind -n M-C-i display-popup -E "nvim -c 'e ~/Nextcloud/wiki/I45/Hendelser.md' -c 'call append(1, strftime(\"- **%d.%m.%Y (%T)** - **\"))' -c 'call append(2, \"\")' -c 'execute \"normal! 2GA\"'" +bind -n M-C-i display-popup -E "nvim -c 'e ~/_library/wiki/I45/Hendelser.md' -c 'call append(1, strftime(\"- **%d.%m.%Y (%T)** - **\"))' -c 'call append(2, \"\")' -c 'execute \"normal! 2GA\"'" # Theme toggling bind-key T run-shell "toggle-theme" @@ -70,7 +70,7 @@ m4_changequote(`, ')m4_dnl # -- Theme -------------------------------------------------------------------- m4_ifelse(DT_DOTFILES_TYPE, `local', `m4_dnl set -g status-left "#{?client_prefix,C-a ,}[#S] " -set -g status-right "%d/%m/%y %H:%M:%S [#(cat /sys/class/power_supply/BAT0/capacity)%]" +set -g status-right "#(tt third-time) %d/%m/%y %H:%M:%S [#(cat /sys/class/power_supply/BAT0/capacity)%]" set -g status-style "fg=colour255,bold,bg=black" ')m4_dnl m4_ifelse(DT_DOTFILES_TYPE, `remote', `m4_dnl |