diff --git a/bash/.bashrc b/bash/.bashrc index 91a816a..232d191 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -2,6 +2,9 @@ # If not running interactively, don't do anything [[ $- != *i* ]] && return +# Ansible defaults +export ANSIBLE_BECOME_ASK_PASS=yes + # Add ~/bin and ~/bin/scripts to my path export PATH=$PATH:$HOME/bin/:$HOME/bin/scripts/:$HOME/.cargo/bin @@ -133,6 +136,8 @@ alias proj="cd-projects" # Use the kitty kitten for ssh so sessions can be cached and remote editing/session cloning is possible. alias ssh="kitty +kitten ssh" +alias paru="paru --bottomup" + #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! export SDKMAN_DIR="$HOME/.sdkman" [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh" diff --git a/eww/_variables.yuck b/eww/_variables.yuck index 63993c5..63f9256 100644 --- a/eww/_variables.yuck +++ b/eww/_variables.yuck @@ -2,10 +2,32 @@ (defpoll year :interval "10h" "date '+%Y'") (defpoll date :interval "30m" "date '+%m-%d'") -(defpoll media-player_art-url :interval "10s" "playerctl metadata mpris:artUrl") -(defpoll media-player_status :interval "10s" "playerctl status") -(defpoll media-player_title :interval "10s" "playerctl metadata xesam:title | ellipse -n 30") -(defpoll media-player_artist :interval "10s" "playerctl metadata xesam:artist") +(defpoll audio_sink_default + :interval "10s" + `pactl get-default-sink`) -; TODO: Change this to a script that gets polled every x seconds. Or even a script in the window manager to update this variable when changing workspace. -(defvar workspace 1) +(defpoll audio_source_default + :interval "10s" + `pactl get-default-source`) + +(deflisten media-player_status + :initial "paused" + "playerctl --player plasma-browser-integration --follow status") + +(deflisten media-player_metadata + :initial "{\"title\": \"Nothing playing\", \"album\": \"\", \"artist\": \"\", \"art_url\": \"\"}" + "playerctl --player plasma-browser-integration --follow metadata --format '{\"title\": \"{{title}}\", \"album\": \"{{album}}\", \"artist\": \"{{artist}}\", \"art_url\": \"{{mpris:artUrl}}\"}'") + +(deflisten media-player_metadata_image + :initial "/tmp/mpris-thumb" + "playerctl --follow --player plasma-browser-integration --follow metadata --format {{mpris:artUrl}} | /home/kalle/bin/scripts/eww-playerctl-download-image") + +(defpoll audio-sinks + :initial "[]" + :interval "10s" + "pactl -f json list sinks | jq '[.[]|{\"id\": .name, \"name\":.description, \"volume\": .volume.\"front-left\".value_percent | rtrimstr(\"%\"), \"muted\": .mute}]'") + +(defpoll audio-sources + :initial "[]" + :interval "10s" + "pactl -f json list sources | jq '[.[] | select(.monitor_source == \"\") | {\"id\": .name, \"name\":.description, \"volume\": .volume.\"front-left\".value_percent | rtrimstr(\"%\"), \"muted\": .mute}]'") diff --git a/eww/audio.yuck b/eww/audio.yuck new file mode 100644 index 0000000..5549154 --- /dev/null +++ b/eww/audio.yuck @@ -0,0 +1,43 @@ +(defwidget audio-sink [sink] + (box + :orientation "v" + (box :space-evenly false :spacing 15 + (box "${sink.id == audio_sink_default ? "x " : ""}${sink.name}") + (box :hexpand true) + (button :onclick "pactl set-sink-mute \"${sink.id}\" toggle" + "M") + (button :onclick "pactl set-default-sink ${sink.id}" + "D") + ) + (box :space-evenly false + (box :width 50 + {sink.muted ? "Muted" : "${sink.volume}%"}) + (scale :hexpand true + :value {sink.volume} + :onchange "pactl set-sink-volume ${sink.id} {}%" + ) + ) + ) +) + +(defwidget audio-source [source] + (box + :orientation "v" + (box :space-evenly false :spacing 15 + (box "${source.id == audio_source_default ? "x " : ""}${source.name}") + (box :hexpand true) + (button :onclick "pactl set-source-mute \"${source.id}\" toggle" + "M") + (button :onclick "pactl set-default-source ${source.id}" + "D") + ) + (box :space-evenly false + (box :width 50 + {source.muted ? "Muted" : "${source.volume}%"}) + (scale :hexpand true + :value {source.volume} + :onchange "pactl set-source-volume ${source.id} {}%" + ) + ) + ) +) diff --git a/eww/bar.yuck b/eww/bar.yuck index 0513cf3..18448d7 100644 --- a/eww/bar.yuck +++ b/eww/bar.yuck @@ -1,11 +1,3 @@ -(defwidget user-icon [] - (eventbox :class "user-icon" - (box :class "img" - :height 50 - :width 50) - ) -) - (defwidget notifications [] (eventbox :class "notifications" "" @@ -24,62 +16,30 @@ ) ) -(defwidget top [] - (box :class "top" - :space-evenly "false" - :valign "start" - :orientation "v" - (user-icon) ; TODO: User Icon - Opens misc menu - (notifications) ; TODO: notifications - Opens notification menu - (audio) ; TODO: Audio - Opens audio menu (music controls and volume) - (clipboard); TODO: Clipboard - Opens clipboard menu (clipboard history click to make current) +(defwidget color-picker [] + (eventbox :class "color-picker" + :onclick "hyprctl dispatch exec \"hyprpicker --no-fancy | wl-copy\"" + "" ) ) -(defwidget workspace [] - (box :class "workspace" - :orientation "v" - :halign "center" - :space-evenly "true" - (box :class {workspace == 1 ? "single-selected" : "single"} - :width 25 - :height 25) - (box :class {workspace == 2 ? "single-selected" : "single"} - :width 25 - :height 25) - (box :class {workspace == 3 ? "single-selected" : "single"} - :width 25 - :height 25) - (box :class {workspace == 4 ? "single-selected" : "single"} - :width 25 - :height 25) - (box :class {workspace == 5 ? "single-selected" : "single"} - :width 25 - :height 25) - (box :class {workspace == 6 ? "single-selected" : "single"} - :width 25 - :height 25) - (box :class {workspace == 7 ? "single-selected" : "single"} - :width 25 - :height 25) - (box :class {workspace == 8 ? "single-selected" : "single"} - :width 25 - :height 25) - (box :class {workspace == 9 ? "single-selected" : "single"} - :width 25 - :height 25) - (box :class {workspace == 10 ? "single-selected" : "single"} - :width 25 - :height 25) +(defwidget left [] + (box :class "left" + :halign "start" + :orientation "h" + (notifications) ; TODO: notifications - Opens notification menu + (audio) + (clipboard); TODO: Clipboard - Opens clipboard menu (clipboard history click to make current) + ;; TODO: Bluetooth something + (color-picker) ) ) (defwidget center [] - (box :class "top" + (box :class "center" :space-evenly "false" :valign "center" - :orientation "v" - (workspace) ; TODO: Workspace indicator - Highlight current workspace (Click to go to?) + :orientation "h" ) ) @@ -91,39 +51,38 @@ (defwidget date [] (eventbox :class "date" - (box :orientation "v" - year - date - ) + "${year}-${date}" ) ) -(defwidget bottom [] - (box :class "top" +(defwidget right [] + (box :class "right" :space-evenly "false" - :valign "end" + :halign "end" + :valign "center" :orientation "v" + ; TODO: Redo this thing and make it open calendar view (time) ; TODO: Time - Open timer/stopwatch menu? - (date) ; TODO: Year month day - Open calendar/upcomming events list (source these from some daemon?) + (date) ; TODO: Year month day - Open calendar/upcoming events list (source these from some daemon?) ) ) (defwidget bar [] (box :class "bar" - :orientation "v" - (top) + :orientation "h" + (left) (center) - (bottom) + (right) ) ) (defwindow bar :monitor 2 :geometry (geometry :x "0px" - :y "0px" - :width "50px" - :height "100%" - :anchor "top left") + :y "10px" + :width "1060px" + :height "50px" + :anchor "center top") :stacking "fg" :exclusive true (bar) diff --git a/eww/eww.scss b/eww/eww.scss index 7fb6397..04ff301 100644 --- a/eww/eww.scss +++ b/eww/eww.scss @@ -1,49 +1,42 @@ $clr-primary: #883333; -$clr-background: rgba(0, 0, 0, 0.75); +$clr-background: rgba(0, 0, 0, 0.5); .bar { background-color: $clr-background; + border-radius: 10px; - .user-icon { - // &:hover { - // background-color: rgba(#888888, 0.2); - // } - .img { - background-image: url("file:///home/kalle/Pictures/Wallpapers/Boat.jpg"); - background-size: cover; - border-radius: 100%; + .notifications, .audio, .clipboard, .color-picker { + label { + font-size: 30px; margin: 5px; } - } - - .notifications, .audio, .clipboard { - font-size: 30px; - margin: 5px; &:hover { color: $clr-primary; // background-color: rgba(#888888, 0.2); } } - .workspace { - .single, .single-selected { - margin: 5px; - border-radius: 100%; - border: 2px solid white; - } + .left { + margin-left: 10px; + } - .single-selected { - border-color: $clr-primary; - } + .right { + margin-right: 10px; } } .audio { background-color: $clr-background; + border-radius: 5px; - .audio-title { - font-size: 30px; + .audio-sinks { + margin-left: 50px; + margin-right: 20px; + } + .audio-sources { + margin-left: 20px; + margin-right: 50px; } .media-player { @@ -76,3 +69,6 @@ $clr-background: rgba(0, 0, 0, 0.75); } +.title { + font-size: 24px; +} diff --git a/eww/eww.yuck b/eww/eww.yuck index 0d6ebda..f27ae82 100644 --- a/eww/eww.yuck +++ b/eww/eww.yuck @@ -1,4 +1,6 @@ (include "_variables.yuck") +(include "util.yuck") +(include "audio.yuck") (include "bar.yuck") (include "volume.yuck") diff --git a/eww/util.yuck b/eww/util.yuck new file mode 100644 index 0000000..cce1960 --- /dev/null +++ b/eww/util.yuck @@ -0,0 +1,5 @@ +(defwidget title [content] + (box :class "title" + content + ) +) diff --git a/eww/volume.yuck b/eww/volume.yuck index b6c1e45..55ad1a5 100644 --- a/eww/volume.yuck +++ b/eww/volume.yuck @@ -6,16 +6,16 @@ circle farthest-side at left, rgba(0, 0, 0, 0.9) 40%, rgba(0, 0, 0, 0.2) 70%), - url('${media-player_art-url}');" + url('${media-player_metadata_image}');" (box :orientation "v" (box :class "title" :halign "start" - media-player_title + {media-player_metadata.title} ) (box :class "artist" :halign "start" - media-player_artist + {media-player_metadata.artist} ) ) @@ -32,7 +32,7 @@ (eventbox :class "pause" :width 40 :onclick "playerctl play-pause" - ${media-player_status == "Playing" ? "" : "契"} + {media-player_status == "Playing" ? "" : "契"} ) (eventbox :class "next" :width 40 @@ -50,23 +50,52 @@ ) ) +(defwidget audio-sinks [] + (box :orientation "v" :class "audio-sinks" :space-evenly false + (title :content "Sinks") + {audio_sink_default ? "" : ""} ;; This is dumb, but fixes this variable not updating + (for sink in audio-sinks + (audio-sink :sink {sink}) + ) + ) +) + +(defwidget audio-sources [] + (box :orientation "v" :class "audio-sources" :space-evenly false + (title :content "Sources") + {audio_source_default ? "" : ""} ;; This is dumb, but fixes this variable not updating + (for source in audio-sources + (audio-source :source {source}) + ) + ) +) + (defwidget audio-window [] (box :class "audio" :orientation "v" :space-evenly false - ; (audio-title) - (media-player) + ;; TODO: Maybe individual applications as well. + (box :orientation "h" + (media-player) + (box + ;; TODO: Put something here + ) + ) + (box :orientation "h" + (audio-sinks) + (audio-sources) + ) ) ) (defwindow audio :monitor 2 - :geometry (geometry :x "50px" - :y "0px" - :width "500px" - :height "100%" - :anchor "top left") - :stacking "fg" - :exclusive true + :geometry (geometry :x "10px" + :y "10px" + :width "1060" + :height "500px" + :anchor "top center") + :stacking "overlay" + :exclusive false (audio-window) ) diff --git a/nvim/lua/kalle/config/plugin-config/bufferline.lua b/nvim/after/plugin/bufferline.lua similarity index 100% rename from nvim/lua/kalle/config/plugin-config/bufferline.lua rename to nvim/after/plugin/bufferline.lua diff --git a/nvim/lua/kalle/config/plugin-config/cmp.lua b/nvim/after/plugin/cmp.lua similarity index 58% rename from nvim/lua/kalle/config/plugin-config/cmp.lua rename to nvim/after/plugin/cmp.lua index faf7bfb..157084a 100644 --- a/nvim/lua/kalle/config/plugin-config/cmp.lua +++ b/nvim/after/plugin/cmp.lua @@ -1,19 +1,36 @@ local cmp = require'cmp' +local luasnip = require'luasnip' cmp.setup({ snippet = { expand = function(args) - vim.fn["vsnip#anonymous"](args.body) + require('luasnip').lsp_expand(args.body) end, }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.select_prev_item(), [''] = cmp.mapping.select_next_item(), -- Add tab support - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.close(), [''] = cmp.mapping.confirm({ @@ -23,13 +40,12 @@ cmp.setup({ }), sources = cmp.config.sources({ { name = 'path' }, -- file paths - { name = 'nvim_lsp', keyword_length = 3 }, -- from language server + { name = 'nvim_lsp' }, -- from language server { name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized - { name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.* - { name = 'buffer', keyword_length = 2 }, -- source current buffer - { name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip + { name = 'luasnip' }, + { name = 'nvim_lua' }, -- complete neovim's Lua runtime API such vim.lsp.* + { name = 'buffer' }, -- source current buffer { name = 'calc'}, -- source for math calculation - { name = 'nvim_lsp' }, }), window = { completion = cmp.config.window.bordered(), @@ -66,18 +82,13 @@ cmp.setup.cmdline('/', { } }) --- TODO: This doesn't seem to work with Noice. Maybe it starts to work with a new release. --- -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). --- cmp.setup.cmdline(':', { --- mapping = cmp.mapping.preset.cmdline(), --- sources = cmp.config.sources({ --- { name = 'path' } --- }, { --- { name = 'cmdline' } --- }) --- }) - --- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) +}) diff --git a/nvim/after/plugin/general.lua b/nvim/after/plugin/general.lua new file mode 100644 index 0000000..0f19551 --- /dev/null +++ b/nvim/after/plugin/general.lua @@ -0,0 +1,15 @@ +require('which-key').setup() +require('neogit').setup() +require('lualine').setup() +require('marks').setup() +require('Comment').setup() +require('illuminate').configure() +require("todo-comments").setup() +require("nvim-autopairs").setup() +require("fidget").setup() +require('nvim-highlight-colors').setup() + +require('gitsigns').setup { + current_line_blame = true, +} + diff --git a/nvim/after/plugin/keymap.lua b/nvim/after/plugin/keymap.lua new file mode 100644 index 0000000..af0bc82 --- /dev/null +++ b/nvim/after/plugin/keymap.lua @@ -0,0 +1,44 @@ +---@diagnostic disable: redefined-local + +local function map(mode, keys, func, desc, silent) + local silent = silent == nil and true or silent + vim.keymap.set(mode, keys, func, {desc = desc, silent = silent}) +end + +-- Movement between windows +map('n', 'h', function() vim.cmd.wincmd('h') end, "Window Left") +map('n', 'j', function() vim.cmd.wincmd('j') end, "Window Down") +map('n', 'k', function() vim.cmd.wincmd('k') end, "Window Up") +map('n', 'l', function() vim.cmd.wincmd('l') end, "Window Right") + +-- Buffer hotkeys +map('n', '1', function() vim.cmd.BufferLineGoToBuffer(1) end, 'Tab 1') +map('n', '2', function() vim.cmd.BufferLineGoToBuffer(2) end, 'Tab 2') +map('n', '3', function() vim.cmd.BufferLineGoToBuffer(3) end, 'Tab 3') +map('n', '4', function() vim.cmd.BufferLineGoToBuffer(4) end, 'Tab 4') +map('n', '5', function() vim.cmd.BufferLineGoToBuffer(5) end, 'Tab 5') +map('n', '6', function() vim.cmd.BufferLineGoToBuffer(6) end, 'Tab 6') +map('n', '7', function() vim.cmd.BufferLineGoToBuffer(7) end, 'Tab 7') +map('n', '8', function() vim.cmd.BufferLineGoToBuffer(8) end, 'Tab 8') +map('n', '9', function() vim.cmd.BufferLineGoToBuffer(9) end, 'Tab 9') + +map('n', 'tt', vim.cmd.NvimTreeToggle, '[T]oggle file [T]ree') +map('n', 'tg', vim.cmd.Neogit, '[T]oggle [G]it view') +map('n', 'tu', require('undotree').toggle, '[T]oggle [U]ndo tree') + +map('n', '[d', vim.diagnostic.goto_prev, 'Goto Previous Diagnostic') +map('n', ']d', vim.diagnostic.goto_next, 'Goto Next Diagnostic') +map('n', 'e', vim.diagnostic.open_float, 'Show [E]rrors') +map('n', 'q', vim.diagnostic.setloclist, 'Errors to [Q]uickfix') + + +map('n', '?', require('telescope.builtin').oldfiles, '[?] Find recently opened files') +map('n', '', require('telescope.builtin').buffers, '[ ] Find existing buffers') +map('n', 'sf', require('telescope.builtin').find_files, '[S]earch [F]iles') +map('n', 'sh', require('telescope.builtin').help_tags, '[S]earch [H]elp') +map('n', 'sw', require('telescope.builtin').grep_string, '[S]earch current [W]ord') +map('n', 'sg', require('telescope.builtin').live_grep, '[S]earch by [G]rep') +map('n', 'sd', require('telescope.builtin').diagnostics, '[S]earch [D]iagnostics') + +map({'n', 't'}, '', require("FTerm").toggle, 'Toggle Terminal') + diff --git a/nvim/after/plugin/lsp.lua b/nvim/after/plugin/lsp.lua new file mode 100644 index 0000000..6ae424d --- /dev/null +++ b/nvim/after/plugin/lsp.lua @@ -0,0 +1,132 @@ +require("mason").setup() +require("mason-lspconfig").setup() + +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + +local on_attach = function(_, bufnr) + local nmap = function(keys, func, desc) + if desc then + desc = 'LSP: ' .. desc + end + + vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) + end + + nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') + nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + + nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + nmap('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- See `:help K` for why this keymap + nmap('K', vim.lsp.buf.hover, 'Hover Documentation') + nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + + -- Lesser used LSP functionality + nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') + nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') + nmap('wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, '[W]orkspace [L]ist Folders') + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) + if vim.lsp.buf.format then + vim.lsp.buf.format() + elseif vim.lsp.buf.formatting then + vim.lsp.buf.formatting() + end + end, { desc = 'Format current buffer with LSP' }) +end + +require("mason-lspconfig").setup_handlers({ + function (server_name) -- default handler (optional) + if server_name == 'sumneko_lua' then + require("lspconfig")[server_name].setup { + capabilities = capabilities, + on_attach = on_attach, + settings = { + Lua = { + diagnostics = { + globals = {'vim'} + }, + runtime = { + version = "LuaJIT", + path = vim.split(package.path, ";") + }, + workspace = { + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true + } + } + } + }, + } + else + require("lspconfig")[server_name].setup { + capabilities = capabilities, + on_attach = on_attach, + } + end + end, +}) + +require('mason-nvim-dap').setup() + + +local rt_config = { + server = { + on_attach = on_attach, + settings = { + ["rust-analyzer"] = { + checkOnSave = { + command = "clippy" + }, + }, + } + }, +} + +require('rust-tools').setup(rt_config) + +-- LSP Diagnostics Options Setup +local sign = function(opts) + vim.fn.sign_define(opts.name, { + texthl = opts.name, + text = opts.text, + numhl = '' + }) +end + +sign({name = 'DiagnosticSignError', text = ''}) +sign({name = 'DiagnosticSignWarn', text = ''}) +sign({name = 'DiagnosticSignHint', text = ''}) +sign({name = 'DiagnosticSignInfo', text = ''}) + +vim.diagnostic.config({ + virtual_text = false, + signs = true, + update_in_insert = true, + underline = true, + severity_sort = false, + float = { + border = 'rounded', + source = 'always', + header = '', + prefix = '', + }, +}) + +vim.cmd([[ +autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) +]]) + + +require('nvim-lightbulb').setup({autocmd = {enabled = true}}) diff --git a/nvim/lua/kalle/config/plugin-config/nvim-tree.lua b/nvim/after/plugin/nvim-tree.lua similarity index 90% rename from nvim/lua/kalle/config/plugin-config/nvim-tree.lua rename to nvim/after/plugin/nvim-tree.lua index b2992a4..dc5b3e9 100644 --- a/nvim/lua/kalle/config/plugin-config/nvim-tree.lua +++ b/nvim/after/plugin/nvim-tree.lua @@ -19,3 +19,5 @@ require('nvim-tree').setup { dotfiles = true, }, } + +require("lsp-file-operations").setup() diff --git a/nvim/after/plugin/telescope.lua b/nvim/after/plugin/telescope.lua new file mode 100644 index 0000000..0791c9b --- /dev/null +++ b/nvim/after/plugin/telescope.lua @@ -0,0 +1,13 @@ +require('telescope').setup { + defaults = { + mappings = { + i = { + [''] = false, + [''] = false, + }, + }, + }, +} + +require("telescope").load_extension("ui-select") +pcall(require('telescope').load_extension, 'fzf') diff --git a/nvim/lua/kalle/config/plugin-config/treesitter.lua b/nvim/after/plugin/treesitter.lua similarity index 92% rename from nvim/lua/kalle/config/plugin-config/treesitter.lua rename to nvim/after/plugin/treesitter.lua index 9ba6223..a95ead9 100644 --- a/nvim/lua/kalle/config/plugin-config/treesitter.lua +++ b/nvim/after/plugin/treesitter.lua @@ -12,6 +12,9 @@ require('nvim-treesitter.configs').setup { enable = true, extended_mode = true, max_file_lines = nil, + }, + autotag = { + enable = true, } } diff --git a/nvim/after/plugin/undotree.lua b/nvim/after/plugin/undotree.lua new file mode 100644 index 0000000..47aca1f --- /dev/null +++ b/nvim/after/plugin/undotree.lua @@ -0,0 +1 @@ +require('undotree').setup() diff --git a/nvim/init.lua b/nvim/init.lua index f848183..6e3522d 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -2,13 +2,21 @@ vim.opt.termguicolors = true vim.opt.clipboard = 'unnamed,unnamedplus' vim.opt.timeoutlen = 300 vim.opt.mouse = 'a' -vim.opt.undodir = vim.fn.expand('~/.cache/vim/undo') vim.opt.listchars = 'tab:▸ ,extends:❯,precedes:❮' +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = vim.fn.expand('~/.cache/vim/undo') +vim.opt.undofile = true + vim.opt.number = true vim.opt.relativenumber = true vim.opt.list = true +vim.opt.wrap = false + +vim.opt.scrolloff = 8 + vim.opt.autoindent = true vim.opt.expandtab = true vim.opt.softtabstop = 4 @@ -19,27 +27,20 @@ vim.opt.modeline = true vim.opt.spell = true -vim.opt.undofile = true vim.g.mapleader = ' ' +vim.opt.hlsearch = false +vim.opt.incsearch = true +vim.opt.signcolumn = 'yes' + +vim.opt.updatetime = 50 vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'} vim.opt.shortmess = vim.opt.shortmess + { c = true} -vim.api.nvim_set_option('updatetime', 100) --- Always show signcolumn -vim.cmd([[ -set signcolumn=yes -]]) - --- Load utilities -require('kalle.utils') -- Load plugins require('kalle.plugins') -vim.cmd('colorscheme carbonfox') - --- Load config -require('kalle.config') +vim.cmd.colorscheme('carbonfox') -- TODO: -- - Debugger integration (gdb?, java?/kotlin?, rust?, etc) - nvim-dap and friends diff --git a/nvim/lua/kalle/config/init.lua b/nvim/lua/kalle/config/init.lua deleted file mode 100644 index ccdc986..0000000 --- a/nvim/lua/kalle/config/init.lua +++ /dev/null @@ -1,3 +0,0 @@ -require('kalle.config.keybinds') -require('kalle.config.neovide') -require('kalle.config.plugin-config') diff --git a/nvim/lua/kalle/config/keybinds.lua b/nvim/lua/kalle/config/keybinds.lua deleted file mode 100644 index a6f6289..0000000 --- a/nvim/lua/kalle/config/keybinds.lua +++ /dev/null @@ -1,52 +0,0 @@ -Keybind.g({ - -- [ space + h ] move cursor to left window - { 'n', 'h', 'wincmd h', { noremap = true, desc = 'Window left' } }, - -- [ space + l ] move cursor to bottom window - { 'n', 'j', 'wincmd j', { noremap = true, desc = 'Window down' } }, - -- [ space + j ] move cursor to top window - { 'n', 'k', 'wincmd k', { noremap = true, desc = 'Window up' } }, - -- [ space + k ] move cursor to right window - { 'n', 'l', 'wincmd l', { noremap = true, desc = 'Window right' } }, - -- [ space + 1 ] tab 1 - { 'n', '1', 'BufferLineGoToBuffer 1', {noremap = true, desc = 'Tab 1' } }, - -- [ space + 2 ] tab 2 - { 'n', '2', 'BufferLineGoToBuffer 2', {noremap = true, desc = 'Tab 2' } }, - -- [ space + 3 ] tab 3 - { 'n', '3', 'BufferLineGoToBuffer 3', {noremap = true, desc = 'Tab 3' } }, - -- [ space + 4 ] tab 4 - { 'n', '4', 'BufferLineGoToBuffer 4', {noremap = true, desc = 'Tab 4' } }, - -- [ space + 5 ] tab 5 - { 'n', '5', 'BufferLineGoToBuffer 5', {noremap = true, desc = 'Tab 5' } }, - -- [ space + 6 ] tab 6 - { 'n', '6', 'BufferLineGoToBuffer 6', {noremap = true, desc = 'Tab 6' } }, - -- [ space + 7 ] tab 7 - { 'n', '7', 'BufferLineGoToBuffer 7', {noremap = true, desc = 'Tab 7' } }, - -- [ space + 8 ] tab 8 - { 'n', '8', 'BufferLineGoToBuffer 8', {noremap = true, desc = 'Tab 8' } }, - -- [ space + 9 ] tab 9 - { 'n', '9', 'BufferLineGoToBuffer 9', {noremap = true, desc = 'Tab 9' } }, - - -- [ space + t ] Toggles - { 'n', 't', '', { noremap = true, desc = '+Toggle' } }, - -- [ space + t + t] Toggle file tree - { 'n', 'tt', 'NvimTreeToggle', { noremap = true, desc = 'Open file tree' } }, - -- [ space + t + g] Neogit - { 'n', 'tg', 'Neogit', { noremap = true, desc = 'Open git status' } }, - - -- [ space + o] Open - { 'n', 'o', '', { noremap = true, desc = '+Open' } }, - -- [ space + o + f] Open file - { 'n', 'of', 'Telescope find_files', { noremap = true, desc = 'Open file' } }, - - -- [ space + c] Code - { 'n', 'c', '', {noremap = true, desc = '+Code' } }, - -- [ space + c + a] Code actions - { 'n', 'ca', 'lua vim.lsp.buf.code_action()', {noremap = true, desc = 'Code actions' } }, - -- [ space + c] - { 'n', 'cr', 'Telescope lsp_references', {noremap = true, desc = 'References' } }, - -- [ space + c] - { 'n', 'cd', 'Telescope lsp_definitions', {noremap = true, desc = 'Definitions' } }, - - { 'n', '', 'lua require("FTerm").toggle()', {noremap = true, desc = 'Terminal' } }, - { 't', '', 'lua require("FTerm").toggle()', {noremap = true, desc = 'Terminal' } }, -}) diff --git a/nvim/lua/kalle/config/neovide.lua b/nvim/lua/kalle/config/neovide.lua deleted file mode 100644 index f010d45..0000000 --- a/nvim/lua/kalle/config/neovide.lua +++ /dev/null @@ -1,10 +0,0 @@ -vim.cmd [[ - set guifont=Fira\ Code\ Nerd\ Font:h11 - let g:neovide_transparency = 0.8 - let g:neovide_floating_blur_amount_x = 2.0 - let g:neovide_floating_blur_amount_y = 2.0 - let g:neovide_scroll_animation_length = 0.1 - let g:neovide_refresh_rate = 144 - let g:neovide_fullscreen = v:false - let g:neovide_cursor_animation_length=0.05 -]] diff --git a/nvim/lua/kalle/config/plugin-config/init.lua b/nvim/lua/kalle/config/plugin-config/init.lua deleted file mode 100644 index 488f6db..0000000 --- a/nvim/lua/kalle/config/plugin-config/init.lua +++ /dev/null @@ -1,62 +0,0 @@ -require('kalle.config.plugin-config.lsp') -require('kalle.config.plugin-config.cmp') -require('kalle.config.plugin-config.treesitter') -require('kalle.config.plugin-config.bufferline') -require('kalle.config.plugin-config.nvim-tree') - -require('which-key').setup {} -require('neogit').setup {} -require('lualine').setup {} -require('marks').setup {} -require('Comment').setup() -require('illuminate').configure() -require("telescope").load_extension("ui-select") -require("todo-comments").setup {} -require'FTerm'.setup {} - -require('gitsigns').setup { - current_line_blame = true, -} - --- TODO: Move this to a better place. -require("noice").setup({ - routes = { - { - filter = { - event = "cmdline", - find = "^%s*[/?]", - }, - view = "cmdline", - }, - }, - views = { - cmdline_popup = { - position = { - row = 5, - col = "50%", - }, - size = { - width = 60, - height = "auto", - }, - }, - popupmenu = { - relative = "editor", - position = { - row = 8, - col = "50%", - }, - size = { - width = 60, - height = 10, - }, - border = { - style = "rounded", - padding = { 0, 1 }, - }, - win_options = { - winhighlight = { Normal = "Normal", FloatBorder = "DiagnosticInfo" }, - }, - }, - }, -}) diff --git a/nvim/lua/kalle/config/plugin-config/lsp.lua b/nvim/lua/kalle/config/plugin-config/lsp.lua deleted file mode 100644 index 3273897..0000000 --- a/nvim/lua/kalle/config/plugin-config/lsp.lua +++ /dev/null @@ -1,91 +0,0 @@ -require("mason").setup() -require("mason-lspconfig").setup() -require("mason-lspconfig").setup_handlers({ - function (server_name) -- default handler (optional) - if server_name == 'sumneko_lua' then - require("lspconfig")[server_name].setup { - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { - globals = {'vim'} - }, - runtime = { - version = "LuaJIT", - path = vim.split(package.path, ";") - }, - workspace = { - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true - } - } - } - }, - } - else - require("lspconfig")[server_name].setup { - capabilities = capabilities, - } - end - end, -}) - -require('mason-nvim-dap').setup() - - -local rt_config = { - server = { - settings = { - on_attach = function(_, bufnr) - -- Hover actions - vim.keymap.set("n", "", rt_config.hover_actions.hover_actions, { buffer = bufnr }) - -- Code action groups - vim.keymap.set("n", "a", rt_config.code_action_group.code_action_group, { buffer = bufnr }) - require 'illuminate'.on_attach(client) - end, - ["rust-analyzer"] = { - checkOnSave = { - command = "clippy" - }, - }, - } - }, -} - -require('rust-tools').setup() - --- LSP Diagnostics Options Setup -local sign = function(opts) - vim.fn.sign_define(opts.name, { - texthl = opts.name, - text = opts.text, - numhl = '' - }) -end - -sign({name = 'DiagnosticSignError', text = ''}) -sign({name = 'DiagnosticSignWarn', text = ''}) -sign({name = 'DiagnosticSignHint', text = ''}) -sign({name = 'DiagnosticSignInfo', text = ''}) - -vim.diagnostic.config({ - virtual_text = false, - signs = true, - update_in_insert = true, - underline = true, - severity_sort = false, - float = { - border = 'rounded', - source = 'always', - header = '', - prefix = '', - }, -}) - -vim.cmd([[ -autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) -]]) - - -require('nvim-lightbulb').setup({autocmd = {enabled = true}}) diff --git a/nvim/lua/kalle/plugins.lua b/nvim/lua/kalle/plugins.lua index 4254ded..000fd20 100644 --- a/nvim/lua/kalle/plugins.lua +++ b/nvim/lua/kalle/plugins.lua @@ -17,15 +17,12 @@ return require('packer').startup({function(use) use('EdenEast/nightfox.nvim') use('folke/which-key.nvim') use('numToStr/FTerm.nvim') - use({ - "folke/noice.nvim", - commit = "312ac20daeae1ba73c300671bbf8d405419a33ef", -- FIX: This is only here because the next commit breaks something... - requires = { - -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries - "MunifTanjim/nui.nvim", - "rcarriga/nvim-notify", - } - }) + + use('brenoprata10/nvim-highlight-colors') + + use('jiaoshijie/undotree') + + use('j-hui/fidget.nvim') use('elkowar/yuck.vim') @@ -36,6 +33,9 @@ return require('packer').startup({function(use) 'nvim-treesitter/nvim-treesitter', run = function() require('nvim-treesitter.install').update({ with_sync = true }) end, } + use('https://git.sr.ht/~p00f/nvim-ts-rainbow') + use('windwp/nvim-autopairs') + use('windwp/nvim-ts-autotag') use { 'kosayoda/nvim-lightbulb', @@ -49,6 +49,14 @@ return require('packer').startup({function(use) }, } + use { + 'antosha417/nvim-lsp-file-operations', + requires = { + { "nvim-lua/plenary.nvim" }, + { "kyazdani42/nvim-tree.lua" }, + } + } + use { "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", @@ -72,9 +80,9 @@ return require('packer').startup({function(use) 'hrsh7th/cmp-path', 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-nvim-lsp-signature-help', - 'hrsh7th/cmp-vsnip', 'hrsh7th/nvim-cmp', - 'hrsh7th/vim-vsnip', + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', } use 'famiu/bufdelete.nvim' diff --git a/nvim/lua/kalle/utils/init.lua b/nvim/lua/kalle/utils/init.lua deleted file mode 100644 index 4ca5ba2..0000000 --- a/nvim/lua/kalle/utils/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -Keybind = require('kalle.utils.keybind') - -Vim = { - Keybind = Keybind, -} diff --git a/nvim/lua/kalle/utils/keybind.lua b/nvim/lua/kalle/utils/keybind.lua deleted file mode 100644 index 17f0b56..0000000 --- a/nvim/lua/kalle/utils/keybind.lua +++ /dev/null @@ -1,37 +0,0 @@ -local Keybind = {} - -Keybind.add_global_keybinds = function (keybinds) - for _, keybind in pairs(keybinds) do - if(keybind[4] == nil) then - keybind[4] = {} - end - - vim.api.nvim_set_keymap( - keybind[1], - keybind[2], - keybind[3], - keybind[4] - ) - end -end - -Keybind.add_buffer_keybinds = function (keybinds) - for _, keybind in pairs(keybinds) do - if(keybind[5] == nil) then - keybind[5] = {} - end - - vim.api.nvim_buf_set_keymap( - keybind[1], - keybind[2], - keybind[3], - keybind[4], - keybind[5] - ) - end -end - -Keybind.g = Keybind.add_global_keybinds -Keybind.b = Keybind.add_buffer_keybinds - -return Keybind diff --git a/nvim/plugin/packer_compiled.lua b/nvim/plugin/packer_compiled.lua index af5b91b..876f4fa 100644 --- a/nvim/plugin/packer_compiled.lua +++ b/nvim/plugin/packer_compiled.lua @@ -89,6 +89,11 @@ _G.packer_plugins = { path = "/home/kalle/.local/share/nvim/site/pack/packer/start/FixCursorHold.nvim", url = "https://github.com/antoinemadec/FixCursorHold.nvim" }, + LuaSnip = { + loaded = true, + path = "/home/kalle/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, ["bufdelete.nvim"] = { loaded = true, path = "/home/kalle/.local/share/nvim/site/pack/packer/start/bufdelete.nvim", @@ -124,10 +129,15 @@ _G.packer_plugins = { path = "/home/kalle/.local/share/nvim/site/pack/packer/start/cmp-path", url = "https://github.com/hrsh7th/cmp-path" }, - ["cmp-vsnip"] = { + cmp_luasnip = { loaded = true, - path = "/home/kalle/.local/share/nvim/site/pack/packer/start/cmp-vsnip", - url = "https://github.com/hrsh7th/cmp-vsnip" + path = "/home/kalle/.local/share/nvim/site/pack/packer/start/cmp_luasnip", + url = "https://github.com/saadparwaiz1/cmp_luasnip" + }, + ["fidget.nvim"] = { + loaded = true, + path = "/home/kalle/.local/share/nvim/site/pack/packer/start/fidget.nvim", + url = "https://github.com/j-hui/fidget.nvim" }, ["gitsigns.nvim"] = { loaded = true, @@ -169,15 +179,10 @@ _G.packer_plugins = { path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nightfox.nvim", url = "https://github.com/EdenEast/nightfox.nvim" }, - ["noice.nvim"] = { + ["nvim-autopairs"] = { loaded = true, - path = "/home/kalle/.local/share/nvim/site/pack/packer/start/noice.nvim", - url = "https://github.com/folke/noice.nvim" - }, - ["nui.nvim"] = { - loaded = true, - path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nui.nvim", - url = "https://github.com/MunifTanjim/nui.nvim" + path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-autopairs", + url = "https://github.com/windwp/nvim-autopairs" }, ["nvim-cmp"] = { loaded = true, @@ -199,21 +204,26 @@ _G.packer_plugins = { path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-dap-virtual-text", url = "https://github.com/theHamsta/nvim-dap-virtual-text" }, + ["nvim-highlight-colors"] = { + loaded = true, + path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-highlight-colors", + url = "https://github.com/brenoprata10/nvim-highlight-colors" + }, ["nvim-lightbulb"] = { loaded = true, path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-lightbulb", url = "https://github.com/kosayoda/nvim-lightbulb" }, + ["nvim-lsp-file-operations"] = { + loaded = true, + path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-lsp-file-operations", + url = "https://github.com/antosha417/nvim-lsp-file-operations" + }, ["nvim-lspconfig"] = { loaded = true, path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", url = "https://github.com/neovim/nvim-lspconfig" }, - ["nvim-notify"] = { - loaded = true, - path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-notify", - url = "https://github.com/rcarriga/nvim-notify" - }, ["nvim-tree.lua"] = { loaded = true, path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", @@ -224,6 +234,16 @@ _G.packer_plugins = { path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-treesitter", url = "https://github.com/nvim-treesitter/nvim-treesitter" }, + ["nvim-ts-autotag"] = { + loaded = true, + path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-ts-autotag", + url = "https://github.com/windwp/nvim-ts-autotag" + }, + ["nvim-ts-rainbow"] = { + loaded = true, + path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-ts-rainbow", + url = "https://git.sr.ht/~p00f/nvim-ts-rainbow" + }, ["nvim-web-devicons"] = { loaded = true, path = "/home/kalle/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", @@ -264,16 +284,16 @@ _G.packer_plugins = { path = "/home/kalle/.local/share/nvim/site/pack/packer/start/todo-comments.nvim", url = "https://github.com/folke/todo-comments.nvim" }, + undotree = { + loaded = true, + path = "/home/kalle/.local/share/nvim/site/pack/packer/start/undotree", + url = "https://github.com/jiaoshijie/undotree" + }, ["vim-illuminate"] = { loaded = true, path = "/home/kalle/.local/share/nvim/site/pack/packer/start/vim-illuminate", url = "https://github.com/RRethy/vim-illuminate" }, - ["vim-vsnip"] = { - loaded = true, - path = "/home/kalle/.local/share/nvim/site/pack/packer/start/vim-vsnip", - url = "https://github.com/hrsh7th/vim-vsnip" - }, ["which-key.nvim"] = { loaded = true, path = "/home/kalle/.local/share/nvim/site/pack/packer/start/which-key.nvim", diff --git a/nvim/spell/en.utf-8.add b/nvim/spell/en.utf-8.add index 479351d..3307c0d 100644 --- a/nvim/spell/en.utf-8.add +++ b/nvim/spell/en.utf-8.add @@ -55,3 +55,6 @@ v2 todo nightfox FTerm +dto +api +loadPage diff --git a/nvim/spell/en.utf-8.add.spl b/nvim/spell/en.utf-8.add.spl index c1bf086..d2c01dd 100644 Binary files a/nvim/spell/en.utf-8.add.spl and b/nvim/spell/en.utf-8.add.spl differ diff --git a/scripts/eww-playerctl-download-image b/scripts/eww-playerctl-download-image new file mode 100755 index 0000000..c743f9e --- /dev/null +++ b/scripts/eww-playerctl-download-image @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +cat | xargs -I '%' curl '%' -o /tmp/mpris-thumb 2>&1 | echo "/tmp/mpris-thumb" + diff --git a/scripts/playlist-dl b/scripts/playlist-dl index 28c2e18..4b176a5 100755 --- a/scripts/playlist-dl +++ b/scripts/playlist-dl @@ -2,7 +2,7 @@ set -x echo "Looking up playlist name..." -pl_line=$(youtube-dl --flat-playlist "$1" | grep "\[download\] Downloading playlist: ") +pl_line=$(yt-dlp --flat-playlist "$1" | grep "\[download\] Downloading playlist: ") pl_name=$(echo ${pl_line:33} | tr '/' ' ') echo "Found playlist by name: $pl_name" @@ -10,5 +10,5 @@ echo "Downloading it into directory: $pl_name" mkdir "$pl_name" cd "$pl_name" -youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" "$1" +yt-dlp --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" "$1" cd ../ diff --git a/scripts/proj_preview b/scripts/proj_preview index 63f8ad1..c5226ef 100755 --- a/scripts/proj_preview +++ b/scripts/proj_preview @@ -1,2 +1,2 @@ #!/usr/bin/env bash -bat -pf `project path "$1"`/README.md +bat -pf "`project path "$1"`"/README.md