November 11 2023 update

This commit is contained in:
Augusto Gunsch 2023-11-11 18:25:46 +01:00
parent 50659b7837
commit 6e78892344
31 changed files with 858 additions and 290 deletions

6
.gitmodules vendored
View File

@ -1,3 +1,9 @@
[submodule "config/awesome/awesome-wm-widgets"]
path = config/awesome/awesome-wm-widgets
url = https://github.com/streetturtle/awesome-wm-widgets
[submodule "config/alacritty/themes"]
path = config/alacritty/themes
url = https://github.com/alacritty/alacritty-theme
[submodule "home/tmux/plugins/tpm"]
path = home/tmux/plugins/tpm
url = https://github.com/tmux-plugins/tpm

View File

@ -8,8 +8,9 @@
#
# All imports must either be absolute paths starting with `/`, or paths relative
# to the user's home directory starting with `~/`.
#import:
# - /path/to/alacritty.yml
import:
#- ~/.config/alacritty/mythemes/onedark.yml
- ~/.config/alacritty/themes/gruvbox_material_medium_dark.yaml
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
@ -203,28 +204,28 @@ font:
#white: '0xFFFFFF'
# XTerm's default colors
colors:
primary:
background: '0xffffff'
foreground: '0x000000'
normal:
black: '0x000000'
red: '0xcd0000'
green: '0x00cd00'
yellow: '0xcdcd00'
blue: '0x0000ee'
magenta: '0xcd00cd'
cyan: '0x00cdcd'
white: '0xe5e5e5'
bright:
black: '0x7f7f7f'
red: '0xff0000'
green: '0x00ff00'
yellow: '0xffff00'
blue: '0x5c5cff'
magenta: '0xff00ff'
cyan: '0x00ffff'
white: '0xffffff'
#colors:
#primary:
#background: '0x303030'
#foreground: '0x000000'
#normal:
#black: '0x000000'
#red: '0xcd0000'
#green: '0x00cd00'
#yellow: '0xcdcd00'
#blue: '0x0000ee'
#magenta: '0xcd00cd'
#cyan: '0x00cdcd'
#white: '0xe5e5e5'
#bright:
#black: '0x7f7f7f'
#red: '0xff0000'
#green: '0x00ff00'
#yellow: '0xffff00'
#blue: '0x5c5cff'
#magenta: '0xff00ff'
#cyan: '0x00ffff'
#white: '0xffffff'
# Colors (Tomorrow Night)
#colors:

View File

@ -0,0 +1,15 @@
colors:
primary:
background: '#282c34'
foreground: '#abb2bf'
bright:
black: '#282c34'
red: '#e06c75'
green: '#98c379'
yellow: '#e5c07b'
blue: '#61afef'
magenta: '#c678dd'
cyan: '#56b6c2'
white: '#abb2bf'
orange: '#d19a66'

@ -0,0 +1 @@
Subproject commit e1b08b5bc06d07dd65f5e72b12fd7f736e0e7928

View File

@ -1,5 +1,7 @@
-- {{{ Modules
local awful = require("awful")
local options = require("options")
-- }}}
-- {{{ Variables
@ -27,25 +29,31 @@ local function kill_apps()
end
end
local function restart()
kill_apps()
awesome.restart()
end
local function quit()
kill_apps()
awesome.quit()
end
local function start()
for _, cmd in ipairs(start_applications) do
awful.spawn.single_instance(cmd)
end
end
local function restart()
kill_apps()
awesome.restart()
awful.spawn(options.terminal .. "-e xmodmap ~/.Xmodmap")
end
-- }}}
--- {{{ Script
for _, cmd in ipairs(start_applications) do
awful.spawn.single_instance(cmd)
end
start()
return {
kill_apps = kill_apps,
restart = restart,
start = start,
quit = quit
}
-- }}}

View File

@ -19,21 +19,21 @@ local function spawnIfNoInstance(command, class)
end
local function work_apps()
spawnIfNoInstance("slack", "Slack")
spawnIfNoInstance("firefox --class WorkFirefox", "WorkFirefox")
spawnIfNoInstance("brave", "Brave")
spawnIfNoInstance("phpstorm", "jetbrains-phpstorm")
spawnIfNoInstance("sh -c 'alacritty --class WorkAlacritty -e tmux new-session -c ~/repos/rockar-peppermint'", "WorkAlacritty")
awful.spawn.with_shell("cd ~/repos/rockar-peppermint; make up")
--spawnIfNoInstance("slack", "Slack")
--spawnIfNoInstance("firefox --class WorkFirefox", "WorkFirefox")
--spawnIfNoInstance("brave", "Brave")
--spawnIfNoInstance("phpstorm", "jetbrains-phpstorm")
--spawnIfNoInstance("sh -c 'alacritty --class WorkAlacritty -e tmux new-session -c ~/repos'", "WorkAlacritty")
--awful.spawn.with_shell("cd ~/repos/rockar-peppermint; make up")
--spawnIfNoInstance("dbeaver", "DBeaver")
end
local function end_work()
awful.spawn("pkill slack")
awful.spawn("xdotool search --class jetbrains-phpstorm windowkill")
awful.spawn("xdotool search --class WorkAlacritty windowquit")
awful.spawn("xdotool search --class WorkFirefox windowkill")
awful.spawn.with_shell("cd ~/repos/rockar-peppermint; make stop")
--awful.spawn("pkill slack")
--awful.spawn("xdotool search --class jetbrains-phpstorm windowkill")
--awful.spawn("xdotool search --class WorkAlacritty windowquit")
--awful.spawn("xdotool search --class WorkFirefox windowkill")
--awful.spawn.with_shell("cd ~/repos/rockar-peppermint; make stop")
-- Dbeaver requires to be killed twice
--awful.spawn("xdotool search --class DBeaver windowkill")
--awful.spawn("xdotool search --class DBeaver windowkill")

View File

@ -62,29 +62,29 @@ awful.rules.rules = {
}, properties = { tag = "1" }
},
{ rule_any = {class = { "WorkFirefox" }
}, properties = { tag = "1" }
},
{ rule_any = {class = { "WorkAlacritty" }
}, properties = { tag = "2" }
},
{ rule_any = {class = { "jetbrains-phpstorm" }
}, properties = { tag = "3" }
},
{ rule_any = {class = { "DBeaver" }
}, properties = { tag = "9" }
},
{ rule_any = {
class = { "DBeaver" },
}, properties = { tag = "9" }
},
{ rule_any = {class = { "Slack" }
}, properties = { tag = "0" }
},
-- { rule_any = {class = { "WorkFirefox" }
-- }, properties = { tag = "1" }
-- },
--
-- { rule_any = {class = { "WorkAlacritty" }
-- }, properties = { tag = "2" }
-- },
--
-- { rule_any = {class = { "jetbrains-phpstorm" }
-- }, properties = { tag = "3" }
-- },
--
-- { rule_any = {class = { "DBeaver" }
-- }, properties = { tag = "9" }
-- },
--
-- { rule_any = {
-- class = { "DBeaver" },
-- }, properties = { tag = "9" }
-- },
--
-- { rule_any = {class = { "Slack" }
-- }, properties = { tag = "0" }
-- },
}
-- }}}

View File

@ -0,0 +1,10 @@
local wk = require("which-key")
wk.register({
["<leader>gs"] = { vim.cmd.Git, "Open git menu" },
["<leader>gd"] = { vim.cmd.Gdiffsplit, "Compare unstaged changes difference" },
}, {
mode = "n",
silent = true,
noremap = true,
})

View File

@ -0,0 +1,16 @@
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
local wk = require("which-key")
wk.register({
["<leader>a"] = { mark.add_file, "Add file to harpoon" },
["<C-e>"] = { ui.toggle_quick_menu, "Toggle quick harpoon menu" },
["g1"] = { function() ui.nav_file(1) end, "Navigate to first file in harpoon"},
["g2"] = { function() ui.nav_file(2) end, "Navigate to second file in harpoon"},
["g3"] = { function() ui.nav_file(3) end, "Navigate to third file in harpoon"},
["g4"] = { function() ui.nav_file(4) end, "Navigate to fourth file in harpoon"}
}, {
mode = "n",
silent = true,
noremap = true,
})

View File

@ -0,0 +1,82 @@
local lsp_zero = require("lsp-zero")
local wk = require("which-key")
wk.register({
["gd"] = { "Go to definitions" },
["K"] = { "Show info" },
["<leader>vws"] = { "View workspace symbol"},
["<leader>vd"] = { "View diagnostics"},
["<leader>vca"] = { "View code action"},
["<leader>vrr"] = { "View references"},
["<leader>vrn"] = { "Rename symbol"},
["[d"] = { "Go to next diagnotics"},
["]d"] = { "Go to previous diagnotics"}
}, {
mode = "n",
silent = true,
noremap = true,
})
wk.register({
["<C-h>"] = { "Signature help"}
}, {
mode = "i",
silent = true,
noremap = true,
})
lsp_zero.on_attach(function(client, bufnr)
local opts = {buffer = bufnr, remap = false}
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
end)
require("mason").setup({})
require("mason-lspconfig").setup({
ensure_installed = {
"tsserver",
"rust_analyzer",
"jedi_language_server",
"clangd"
},
handlers = {
lsp_zero.default_setup,
lua_ls = function()
local lua_opts = lsp_zero.nvim_lua_ls()
require("lspconfig").lua_ls.setup(lua_opts)
end,
}
})
local cmp = require("cmp")
local cmp_select = {behavior = cmp.SelectBehavior.Select}
cmp.setup({
sources = {
{name = "path"},
{name = "nvim_lsp"},
{name = "nvim_lua"},
{name = "luasnip"}
},
formatting = lsp_zero.cmp_format(),
mapping = cmp.mapping.preset.insert({
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
["<C-y>"] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
}),
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
})

View File

@ -0,0 +1,55 @@
require("lualine").setup {
options = {
icons_enabled = false,
theme = "gruvbox-material",
--component_separators = { left = "", right = ""},
--section_separators = { left = "", right = ""},
component_separators = { left = "|", right = "|"},
section_separators = { left = "", right = ""},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {"mode"},
lualine_b = {"branch", "diff", "diagnostics"},
lualine_c = {"filename"},
lualine_x = {"encoding", "fileformat", "filetype"},
lualine_y = {"progress"},
lualine_z = {"location"}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {"filename"},
lualine_x = {"location"},
lualine_y = {},
lualine_z = {}
},
tabline = {
lualine_a = {
{
"tabs",
mode = 2
}
},
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
--lualine_z = {"buffers"}
lualine_z = {}
},
winbar = {},
inactive_winbar = {},
extensions = {}
}

View File

@ -0,0 +1,7 @@
local null_ls = require('null-ls')
null_ls.setup({
sources = {
null_ls.builtins.diagnostics.eslint,
},
})

View File

@ -0,0 +1,79 @@
local tree = require("nvim-tree")
local api = require("nvim-tree.api")
local wk = require("which-key")
tree.setup({
view = {
number = true,
relativenumber = true
},
tab = {
sync = {
open = true,
close = true
}
}
})
local tree_smart_toggle = function ()
local currentBuf = vim.api.nvim_get_current_buf()
local currentBufFt = vim.api.nvim_get_option_value("filetype", { buf = currentBuf })
if currentBufFt == "NvimTree" then
api.tree.close()
else
api.tree.focus()
end
end
wk.register({
["<C-n>"] = { tree_smart_toggle, "Toggle file tree"}
}, {
mode = "n",
silent = true,
noremap = true,
})
-- Open tree on startup
--vim.api.nvim_create_autocmd("VimEnter", {
-- callback = function(ev)
-- api.tree.open()
-- vim.cmd.wincmd("l")
-- end
--})
local function tab_win_closed(winnr)
local api = require"nvim-tree.api"
local tabnr = vim.api.nvim_win_get_tabpage(winnr)
local bufnr = vim.api.nvim_win_get_buf(winnr)
local buf_info = vim.fn.getbufinfo(bufnr)[1]
local tab_wins = vim.tbl_filter(function(w) return w~=winnr end, vim.api.nvim_tabpage_list_wins(tabnr))
local tab_bufs = vim.tbl_map(vim.api.nvim_win_get_buf, tab_wins)
if buf_info.name:match(".*NvimTree_%d*$") then -- close buffer was nvim tree
-- Close all nvim tree on :q
if not vim.tbl_isempty(tab_bufs) then -- and was not the last window (not closed automatically by code below)
api.tree.close()
end
else -- else closed buffer was normal buffer
if #tab_bufs == 1 then -- if there is only 1 buffer left in the tab
local last_buf_info = vim.fn.getbufinfo(tab_bufs[1])[1]
if last_buf_info.name:match(".*NvimTree_%d*$") then -- and that buffer is nvim tree
vim.schedule(function ()
if #vim.api.nvim_list_wins() == 1 then -- if its the last buffer in vim
vim.cmd "quit" -- then close all of vim
else -- else there are more tabs open
vim.api.nvim_win_close(tab_wins[1], true) -- then close only the tab
end
end)
end
end
end
end
vim.api.nvim_create_autocmd("WinClosed", {
callback = function ()
local winnr = tonumber(vim.fn.expand("<amatch>"))
vim.schedule_wrap(tab_win_closed(winnr))
end,
nested = true
})

View File

@ -0,0 +1,9 @@
local wk = require("which-key")
wk.register({
["<C-t>"] = { vim.cmd.TagbarToggle, "Toggle symbols tree browser" },
}, {
mode = "n",
silent = true,
noremap = true,
})

View File

@ -0,0 +1,18 @@
local builtin = require('telescope.builtin')
local wk = require("which-key")
wk.register({
["<leader>ff"] = { builtin.find_files, "Find files" },
["<C-p>"] = { builtin.git_files, "Find git files" },
["<leader>fs"] = {
function ()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end,
"Grep files"
},
["<leader>fh"] = { builtin.help_tags, "Find documentation" }
}, {
mode = "n",
silent = true,
noremap = true,
})

View File

@ -0,0 +1,21 @@
require"nvim-treesitter.configs".setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "rust", "python", "javascript", "typescript" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on "syntax" being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}

View File

@ -0,0 +1,9 @@
local wk = require("which-key")
wk.register({
["<leader>ut"] = { vim.cmd.UndotreeToggle, "Toggle undo history browser" },
}, {
mode = "n",
silent = true,
noremap = true,
})

View File

@ -0,0 +1,98 @@
local wk = require("which-key")
wk.register({
["<leader>sv"] = {
"Reload Neovim configuration"
},
["<leader>p"] = {
function ()
local file_path = vim.fn.expand("%")
vim.fn.setreg("+", file_path)
print("Copied \"" .. file_path .. "\" to clipboard.")
end,
"Copy relative file path to clipboard"
},
["<C-h>"] = { wk.show, "Show this help message" },
["<C-s>"] = { vim.cmd.w, "Save buffer" },
["<C-w>t"] = { vim.cmd.tabnew, "Open a new tab" },
["<leader>ix"] = {
function ()
vim.o.expandtab = true
end,
"Change identation style to spaces"
},
["<leader>in"] = {
function ()
vim.o.expandtab = false
end,
"Change identation style to tab"
},
['<leader>rw'] = {
function ()
vim.cmd("%s/[ \\t]*$//g")
vim.cmd.noh()
end,
'Remove trailing whitespace'
},
["<leader>e"] = { vim.diagnostic.open_float, "Show diagnostics error details" },
["<leader>n"] = { "Rename symbol under cursor" },
["[d"] = { vim.diagnostic.goto_prev, "Go to previous diagnostics error" },
["]d"] = { vim.diagnostic.goto_next, "Go to next diagnostics error" },
["gD"] = { "Go to declaration" },
["gd"] = { "Go to definition" },
["dL"] = { "0D", "Truncate line" },
["_"] = {
function ()
local line = vim.fn.line(".")
local last_line = vim.fn.line("$")
if line ~= last_line then
vim.cmd.m("+1")
end
end,
"Move line down"
},
["-"] = {
function ()
local line = vim.fn.line(".")
if line ~= 1 then
vim.cmd.m("-2")
end
end,
"Move line up"
},
["H"] = { "0", "Same as 0" },
["L"] = { "$", "Same as $" },
}, {
mode = "n",
silent = true,
noremap = true
})
wk.register({
["<C-w>"] = { "<bs>", "Same as backspace" },
}, {
mode = "i",
silent = true,
noremap = true,
})
wk.register({
["s\""] = { "<esc>`<i\"<esc>`><right>a\"<esc>", "Surround with \"\"" },
["s\'"] = { "<esc>`<i\'<esc>`><right>a\'<esc>", "Surround with \'\'" },
["s "] = { "<esc>`<i <esc>`><right>a <esc>", "Surround with space" },
["s("] = { "<esc>`<i(<esc>`><right>a)<esc>", "Surround with ()" },
["s)"] = { "<esc>`<i(<esc>`><right>a)<esc>", "Surround with ()" },
["s["] = { "<esc>`<i[<esc>`><right>a]<esc>", "Surround with []" },
["s]"] = { "<esc>`<i[<esc>`><right>a]<esc>", "Surround with []" },
["s{"] = { "<esc>`<i{<esc>`><right>a}<esc>", "Surround with {}" },
["s}"] = { "<esc>`<i{<esc>`><right>a}<esc>", "Surround with {}" },
["J"] = { ":m '>+1<CR>gv=gv", "Move lines down" },
["K"] = { ":m '<-2<CR>gv=gv", "Move lines up" },
["<leader>y"] = { "\"+y", "Copy to system clipboard" },
}, {
mode = "v",
silent = true,
noremap = true,
})

1
config/nvim/init.lua Normal file
View File

@ -0,0 +1 @@
require('augustogunsch')

View File

@ -1,180 +0,0 @@
syntax on
filetype on
filetype plugin on
set encoding=utf-8
set clipboard=unnamedplus
set nu rnu
set smartindent
set nocp
set bo=all
set list
set listchars=tab:*·,lead,trail:~,extends:>,precedes:<
filetype indent off
hi SignColumn ctermbg=233
hi DiffChange ctermbg=17
hi DiffDelete ctermbg=52 ctermfg=15
hi DiffAdd ctermbg=22
hi DiffText ctermbg=166 ctermfg=15
hi Folded ctermbg=233 ctermfg=247
hi FoldColumn ctermbg=233 ctermfg=247
" matchit builtin plugin
packadd! matchit
let mapleader = " "
let maplocalleader = ","
nnoremap <silent> <F2> <cmd>Gdiffsplit<cr>
nnoremap <silent> <F3> <cmd>%!sed 's/[ \t]*$//'<cr>
nnoremap <silent> <F4> <cmd>%s/"/'/g<cr>
nnoremap <silent> <F5> <cmd>ToggleDiag<cr>
nnoremap <silent> <F6> <cmd>%!expand -t4<cr><cmd>%!sed 's/[ \t]*$//'<cr>
nnoremap <silent> <F7> <cmd>%!unexpand -t4<cr><cmd>%!sed 's/[ \t]*$//'<cr>
nnoremap <silent> <F8> <cmd>TagbarToggle<CR>
nnoremap <silent> <F9> <cmd>%s/\([( -]\)0\.\(\d\)/\1.\2/gc<CR>
nnoremap <silent> <F12> <cmd>set et<cr><cmd>set ts=4<cr><cmd>set sw=4<cr>
nnoremap <silent> <F11> <cmd>set noet<cr>
nnoremap <silent> <C-n> <cmd>NERDTreeToggle<cr>
nnoremap <silent> <C-p> <cmd>let @+=expand("%")<cr><cmd>echo "Copied relative file path to clipboard."<cr>
nnoremap <silent> <leader>ev <cmd>tabnew $MYVIMRC<cr>
nnoremap <silent> <leader>sv <cmd>source $MYVIMRC<cr><cmd>AirlineRefresh<cr>
nnoremap <C-s> <cmd>w<cr>
nnoremap <C-b> :%s//gc<left><left><left>
nnoremap <silent> <C-w>t <cmd>tabnew<cr>
nnoremap dL 0D
nnoremap - ddp
nnoremap _ ddkP
" auto quote
vnoremap <leader>" <esc>a"<esc>`<i"<esc>`>
nnoremap H 0
nnoremap L $
augroup python
autocmd FileType python :iabbrev <buffer> frompdb from pdb import set_trace; set_trace()
augroup END
augroup nerdtree
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
augroup END
let g:airline_theme = "papercolor"
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let g:airline#extensions#nerdtree_statusline = 1
call plug#begin('~/.config/nvim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/nerdcommenter'
" LSP config
Plug 'neovim/nvim-lspconfig'
" *auto* completion
Plug 'hrsh7th/nvim-compe'
Plug 'tpope/vim-fugitive'
Plug 'drmingdrmer/xptemplate'
"Plug 'WhoIsSethDaniel/toggle-lsp-diagnostics.nvim'
Plug 'preservim/tagbar'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-obsession'
Plug 'olimorris/onedarkpro.nvim'
call plug#end()
lua << EOF
--- nvim-compe
require'compe'.setup {
enabled = true;
autocomplete = true;
debug = false;
min_length = 1;
preselect = 'enable';
throttle_time = 80;
source_timeout = 200;
incomplete_delay = 400;
max_abbr_width = 100;
max_kind_width = 100;
max_menu_width = 100;
documentation = true;
source = {
path = true;
nvim_lsp = true;
};
}
--- IMPORTANT
vim.api.nvim_set_keymap('i', '<cr>', 'compe#confirm("<cr>")', { expr = true })
local common_bindings = function(client, bufnr)
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local opts = { noremap=true, silent=true }
--Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
buf_set_keymap('n', '<C-[>', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
end
local default_formatting = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local opts = { noremap=true, silent=true }
buf_set_keymap('n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end
local default_attach = function(client, bufnr)
common_bindings(client, bufnr)
default_formatting(client, bufnr)
end
local setup = function(lsp, on_attach, settings)
local nvim_lsp = require('lspconfig')
nvim_lsp[lsp].setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
},
settings=settings
}
end
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'clangd', 'rls', 'tsserver', 'jedi_language_server', 'phan'}
for _, lsp in ipairs(servers) do
setup(lsp, default_attach)
end
EOF
colorscheme onelight
" auto close scratch buffer (preview window)
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
" xptemplate (snippets) config
let g:xptemplate_vars = "SPcmd=&SParg="

182
config/nvim/init.vim.old Normal file
View File

@ -0,0 +1,182 @@
call plug#begin('~/.config/nvim/plugged')
" Airline
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Gruvbox theme
Plug 'morhetz/gruvbox'
Plug 'sainnhe/gruvbox-material'
" Tree for searching files
Plug 'scrooloose/nerdtree'
Plug 'PhilRunninger/nerdtree-visual-selection'
" Quick comment/uncomment lines
Plug 'scrooloose/nerdcommenter'
" Auto complete quotes
Plug 'raimondi/delimitmate'
" Changing quotes/tags/parenthesis
" See :help surround
" Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
" Git integration
Plug 'tpope/vim-fugitive'
" File symbols browser
Plug 'preservim/tagbar'
" Fuzzy finder
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" Indentation style guesser
Plug 'tpope/vim-sleuth'
" Session manager
Plug 'tpope/vim-obsession'
" Cheat sheet
Plug 'folke/which-key.nvim'
" LSP
Plug 'neovim/nvim-lspconfig'
" nvim-cmp
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
" Snippets
Plug 'L3MON4D3/LuaSnip', {'tag': 'v2.*', 'do': 'make install_jsregexp'}
Plug 'rafamadriz/friendly-snippets'
Plug 'saadparwaiz1/cmp_luasnip'
" Eslint
Plug 'nvim-lua/plenary.nvim'
Plug 'nvimtools/none-ls.nvim'
call plug#end()
augroup nerdtree
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif
autocmd VimEnter * NERDTree | wincmd p
augroup END
let g:NERDTreeShowLineNumbers = 1
colorscheme gruvbox
let g:airline_theme = "gruvbox_material"
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let g:airline#extensions#nerdtree_statusline = 1
" auto close scratch buffer (preview window)
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
lua << EOF
require('luasnip.loaders.from_vscode').lazy_load()
local wk = require('which-key')
wk.register({
['<C-t>'] = { '<cmd>TagbarToggle<cr>', 'Toggle symbols tree browser' },
['<leader>ff'] = { '<cmd>Files<cr>', 'Find a file' },
['<leader>ft'] = { '<cmd>Ag<cr>', 'Find text' },
}, {
mode = 'n',
silent = true,
noremap = true,
})
wk.register({
['<C-l>'] = { '<esc>bEa, ', 'Add , at the end of next WORD' },
}, {
mode = 'i',
silent = true,
noremap = true,
})
local on_attach = function(client, bufnr)
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', '<leader>n', vim.lsp.buf.rename, bufopts)
end
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
}, {
{ name = 'buffer' },
})
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- Clang LSP
require('lspconfig')['clangd'].setup {
on_attach = on_attach,
capabilities = capabilities
}
-- Rust LSP
require('lspconfig')['rls'].setup {
on_attach = on_attach,
capabilities = capabilities
}
-- TypeScript LSP
require('lspconfig')['tsserver'].setup {
on_attach = on_attach,
capabilities = capabilities
}
-- Python LSP
require('lspconfig')['jedi_language_server'].setup {
on_attach = on_attach,
capabilities = capabilities
}
local null_ls = require('null-ls')
null_ls.setup({
sources = {
null_ls.builtins.diagnostics.eslint,
},
})
EOF

View File

@ -0,0 +1,25 @@
require("augustogunsch.lazy")
require("augustogunsch.options")
--- Reload the entire configuration
function reload_config()
for name,_ in pairs(package.loaded) do
if name:match("^augustogunsch") then
package.loaded[name] = nil
end
end
require("augustogunsch")
-- Reload after/ directory
local glob = vim.fn.stdpath("config") .. "/after/**/*.lua"
local after_lua_filepaths = vim.fn.glob(glob, true, true)
for _, filepath in ipairs(after_lua_filepaths) do
dofile(filepath)
end
vim.notify("Nvim configuration reloaded", vim.log.levels.INFO)
end
vim.keymap.set("n", "<leader>sv", reload_config)

View File

@ -0,0 +1,87 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
local plugins = {
-- gruvbox-material theme
{
"sainnhe/gruvbox-material",
lazy = false,
priority = 1000,
config = function ()
vim.cmd.colorscheme("gruvbox-material")
end,
},
-- keys cheat sheet
{
"folke/which-key.nvim",
lazy = false,
priority = 999
},
-- status and tab lines
"nvim-lualine/lualine.nvim",
-- treesitter
{
"nvim-treesitter/nvim-treesitter",
cmd = "TSUpdate"
},
{
"ThePrimeagen/harpoon",
dependencies = {
"nvim-lua/plenary.nvim",
}
},
{
"nvim-tree/nvim-tree.lua",
enabled = true
},
"raimondi/delimitmate",
"tpope/vim-surround",
"tpope/vim-repeat",
"tpope/vim-fugitive",
"numToStr/Comment.nvim",
-- mason LSP manager
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
-- indentation guesser
"tpope/vim-sleuth",
-- file symbols browser
"preservim/tagbar",
-- undo history browser
"mbbill/undotree",
-- fuzzy finder
"nvim-telescope/telescope.nvim",
-- LSP support
{
"VonHeikemen/lsp-zero.nvim",
branch = "v3.x",
lazy = true,
config = false,
},
"neovim/nvim-lspconfig",
-- autocompletion
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
-- snippets
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"rafamadriz/friendly-snippets",
"nvim-lua/plenary.nvim",
"nvimtools/none-ls.nvim",
}
require("lazy").setup(plugins)

View File

@ -0,0 +1,29 @@
-- Disable newtrw
-- required by nvim-tree
vim.opt.guicursor = ""
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.g.mapleader = " "
vim.opt.termguicolors = true
vim.opt.expandtab = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.list = true
vim.opt.listchars = {
tab = "",
lead = "·",
trail = "~",
extends = ">",
precedes = "<"
}
vim.opt.number = true
vim.opt.relativenumber = true
-- To avoid bad habits
vim.opt.mouse = ""

View File

@ -1,6 +0,0 @@
#!/bin/sh
set -e
curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
nvim -E -c PlugInstall -c qall

4
configure-tmux.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
set -e
~/.tmux/plugins/tpm/bin/install_plugins

View File

@ -1,4 +1,7 @@
export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$HOME/.config/composer/vendor/bin:$PATH"
export PATH="/usr/local/texlive/2023/bin/x86_64-linux:$PATH"
export MANPATH="/usr/local/texlive/2023/texmf-dist/doc/man:$MANPATH"
export INFOPATH="/usr/local/texlive/2023/texmf-dist/doc/info:$INFOPATH"
export EDITOR="/usr/bin/nvim"
# vim
@ -69,6 +72,7 @@ alias nvm="load_nvm; nvm"
alias node="load_nvm; node"
alias npm="load_nvm; npm"
alias npx="load_nvm; npx"
alias yarn="load_nvm; yarn"
alias create-react-app="load_nvm; create-react-app"
export NVM_DIR="$HOME/.nvm"
@ -80,7 +84,7 @@ load_nvm() {
unalias npm
unalias npx
unalias create-react-app
. "$NVM_DIR/nvm.sh"
. "$NVM_DIR/bash_completion"
. /usr/share/nvm/init-nvm.sh
. /usr/share/nvm/bash_completion
fi
}

View File

@ -1,4 +1,8 @@
Host vps
User root
HostName augustogunsch.com
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_rsa_secure
host github
HostName github.com
IdentityFile ~/.ssh/id_rsa_secure

View File

@ -22,9 +22,16 @@ bind l select-pane -R
bind k select-pane -U
bind j select-pane -D
# move windows
bind-key -n C-S-Left swap-window -d -t -1
bind-key -n C-S-Right swap-window -d -t +1
# don't rename windows automatically
#set-option -g allow-rename off
# renumber windows automatically
set-option -g renumber-windows on
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf
@ -38,7 +45,8 @@ bind-key * kill-pane
######################
# makes promt colorful
set -g default-terminal "screen-256color"
set -g default-terminal "tmux-256color"
set -as terminal-overrides ",alacritty*:Tc"
# loud or quiet?
set -g visual-activity off
@ -47,41 +55,13 @@ set -g visual-silence off
setw -g monitor-activity off
set -g bell-action none
# modes
setw -g clock-mode-colour colour5
setw -g mode-style 'fg=colour1 bg=colour18 bold'
# panes
set -g pane-border-style 'fg=colour19 bg=colour0'
set -g pane-active-border-style 'bg=colour0 fg=colour9'
# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-style 'bg=colour233 fg=colour255'
set -g status-left '#[fg=colour249,bg=colour237]  tmux #[bg=colour233,fg=colour237]'
set -g status-right '#[bg=colour233,fg=colour21]#[fg=colour255,bg=colour21]  %d/%m  %H:%M '
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-format '#[fg=colour233,bg=colour21]#[bg=colour21,fg=colour184] #I#[fg=colour255]-#W #[bg=colour233,fg=colour21]'
setw -g window-status-format '#[fg=colour233,bg=colour237]#[bg=colour237,fg=colour184] #I#[fg=colour249]-#W #[bg=colour233,fg=colour237]'
setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'
setw -g window-status-separator ''
# messages
set -g message-style 'bg=colour27 fg=white'
# set default shell
set-option -g default-shell $SHELL
# save nvim session
set -g @resurrect-strategy-nvim 'session'
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'hasundue/tmux-gruvbox-material'
set -g @gruvbox-material_theme 'dark' # or 'light'
set -g @gruvbox-material_contrast 'medium' # or 'soft' or 'hard'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

1
home/tmux/plugins/tpm Submodule

@ -0,0 +1 @@
Subproject commit 99469c4a9b1ccf77fade25842dc7bafbc8ce9946

View File

@ -23,9 +23,11 @@ bindkey "^[OB" history-beginning-search-forward-end
bindkey "^[[A" history-beginning-search-backward-end
bindkey "^[[B" history-beginning-search-forward-end
autoload -U promptinit
promptinit
export PROMPT='%B%F{4}[%F{20}%n@%m %F{124}%~%F{4}]$%b%f '
export LS_COLORS='di=1;94:ex=4;92:ln=3;96'
export PROMPT="%F{9}[%F{11}%n@%F{11}%m %F{15}%~%F{9}]$%b%f "
export RPROMPT="%T"
# aliases:
source ~/.aliases