diff options
-rw-r--r-- | htop/htoprc | 16 | ||||
-rw-r--r-- | launch/config | 9 | ||||
-rwxr-xr-x | nvim/init.vim | 51 | ||||
-rw-r--r-- | nvim/lua/init.lua | 1 | ||||
-rw-r--r-- | nvim/lua/user/cmp.lua | 129 | ||||
-rw-r--r-- | nvim/lua/user/lsp/handlers.lua | 104 | ||||
-rw-r--r-- | nvim/lua/user/lsp/init.lua | 7 | ||||
-rw-r--r-- | nvim/lua/user/lsp/mason.lua | 47 | ||||
-rw-r--r-- | nvim/lua/user/lsp/null-ls.lua | 19 | ||||
-rwxr-xr-x | x11/xinitrc | 1 | ||||
-rwxr-xr-x | x11/xprofile.T495 | 4 | ||||
-rwxr-xr-x | zsh/zprofile | 1 |
12 files changed, 366 insertions, 23 deletions
diff --git a/htop/htoprc b/htop/htoprc index e7a2fdf..dac8da7 100644 --- a/htop/htoprc +++ b/htop/htoprc @@ -1,15 +1,17 @@ # Beware! This file is rewritten by htop when settings are changed in the interface. # The parser is also very primitive, and not human-friendly. -htop_version=3.2.1 +htop_version=3.2.2 config_reader_min_version=3 fields=0 48 124 46 47 109 110 17 2 18 49 16 1 hide_kernel_threads=1 hide_userland_threads=0 +hide_running_in_container=0 shadow_other_users=0 show_thread_names=0 show_program_path=1 highlight_base_name=1 highlight_deleted_exe=1 +shadow_distribution_path_prefix=0 highlight_megabytes=1 highlight_threads=1 highlight_changes=0 @@ -37,19 +39,19 @@ column_meter_modes_0=1 1 1 2 2 2 column_meters_1=Hostname Clock Uptime Battery Blank LoadAverage Tasks column_meter_modes_1=2 2 2 2 2 2 2 tree_view=0 -sort_key=47 -tree_sort_key=124 +sort_key=46 +tree_sort_key=46 sort_direction=-1 -tree_sort_direction=1 +tree_sort_direction=-1 tree_view_always_by_pid=0 all_branches_collapsed=0 screen:Main=PID USER EXE PERCENT_CPU PERCENT_MEM IO_READ_RATE IO_WRITE_RATE PRIORITY STATE NICE TIME CSTIME Command -.sort_key=PERCENT_MEM -.tree_sort_key=EXE +.sort_key=PERCENT_CPU +.tree_sort_key=PERCENT_CPU .tree_view=0 .tree_view_always_by_pid=0 .sort_direction=-1 -.tree_sort_direction=1 +.tree_sort_direction=-1 .all_branches_collapsed=0 screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE .sort_key=IO_RATE diff --git a/launch/config b/launch/config index b63a988..21446b6 100644 --- a/launch/config +++ b/launch/config @@ -1,30 +1,37 @@ #HOSTS +host fedora ++host T495 +host voidx250 +host librex60 #OPTS firefox|brave firefox -P default-esr + firefox firefox -P default-default iceweasel -P default-release ff-school|chromium|chrome firefox -P School - ^ + firefox + 1 iceweasel -P School halt|off|poweroff|shutdown doas poweroff ^ ^ + ^ suspend|zzz doas systemctl suspend + ^ doas zzz - reboot|res|restart doas reboot 1 1 + 1 snes9x snes9x -fullscreen -xvideo + ^ snex9x-gtk - diff --git a/nvim/init.vim b/nvim/init.vim index 26fe0ad..699fcb4 100755 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -12,23 +12,37 @@ Plug 'ap/vim-css-color' Plug 'junegunn/goyo.vim' Plug 'vimwiki/vimwiki' Plug 'tpope/vim-commentary' +Plug 'hrsh7th/nvim-cmp' " The completion plugin +Plug 'hrsh7th/cmp-buffer' " buffer completions +Plug 'hrsh7th/cmp-path' " path completions +Plug 'hrsh7th/cmp-cmdline' " cmdline completions +Plug 'hrsh7th/cmp-nvim-lsp' +Plug 'saadparwaiz1/cmp_luasnip' " snippet completions +Plug 'L3MON4D3/LuaSnip' " snippet engine +Plug 'rafamadriz/friendly-snippets' " a bunch of snippets to use +Plug 'neovim/nvim-lspconfig' " enable LSP +Plug 'williamboman/mason.nvim' " simple to use language server installer +Plug 'williamboman/mason-lspconfig.nvim' " simple to use language server installer call plug#end() +" lua require('user.cmp') +" lua require('user.lsp') + "" Basic options -set autochdir " Always change directory to current file -set autoindent " Keeps indentation on new lines -set hlsearch " Highlight search hits -set ignorecase " Case-insensitive search... -set linebreak " Word wrap -set list " Show whitespace characters defined in listchars -set listchars=tab:▏\ \,space:· " Highlight tabs and spaces -set mouse=a " Because sometimes it's just easier to use the mouse -set number relativenumber " Enable relative line numbers -set smartcase " ...Unless the search term is capital -set splitbelow splitright " Open splits on bottom/right instead of top/left -set termguicolors " Enable GUI colors for the terminal to get truecolor -set wildmode=longest,list,full " Enable file auto-complete -syntax on " Enable syntax highlighting +set autochdir " Always change directory to current file +set autoindent " Keeps indentation on new lines +set hlsearch " Highlight search hits +set ignorecase " Case-insensitive search... +set linebreak " Word wrap +set list " Show whitespace characters defined in listchars +set listchars=tab:▏\ \,space:· " Highlight tabs and spaces +set mouse=a " Because sometimes it's just easier to use the mouse +set number relativenumber " Enable relative line numbers +set smartcase " ...Unless the search term is capital +set splitbelow splitright " Open splits on bottom/right instead of top/left +set termguicolors " Enable GUI colors for the terminal to get truecolor +set wildmode=longest,list,full " Enable file auto-complete +syntax on " Enable syntax highlighting " Get rid of the pointless .viminfo files that clutter the home directory let skip_defaults_vim=1 @@ -37,6 +51,13 @@ set viminfo="" " Disables automatic commenting on newline: autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o +" Tabbing +let tabwidth = 4 +set tabstop=4 " Set width of tabs to 4 instead of default 8 +set shiftwidth=4 " Tab key will only insert 1 tab +" Use tabs instead of spaces +autocmd FileType sass setlocal noet ci pi sts=0 sw=4 ts=4 + "" Plugin options " Closetag let g:closetag_filenames = '*.html,*.xhtml,*.phtml' @@ -160,4 +181,4 @@ augroup END "" Auto compile " Sass -autocmd BufWritePost [^_]*.sass,[^_]*.scss silent !sass %:p %:p:r.css +"autocmd BufWritePost [^_]*.sass,[^_]*.scss silent !sass %:p %:p:r.css diff --git a/nvim/lua/init.lua b/nvim/lua/init.lua new file mode 100644 index 0000000..7a62678 --- /dev/null +++ b/nvim/lua/init.lua @@ -0,0 +1 @@ +require "user.cmp" diff --git a/nvim/lua/user/cmp.lua b/nvim/lua/user/cmp.lua new file mode 100644 index 0000000..c83ddce --- /dev/null +++ b/nvim/lua/user/cmp.lua @@ -0,0 +1,129 @@ +local cmp_status_ok, cmp = pcall(require, "cmp") +if not cmp_status_ok then + return +end + +local snip_status_ok, luasnip = pcall(require, "luasnip") +if not snip_status_ok then + return +end + +require("luasnip/loaders/from_vscode").lazy_load() + +local check_backspace = function() + local col = vim.fn.col "." - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" +end + +-- פּ ﯟ some other good icons +local kind_icons = { + Text = "", + Method = "m", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", +} +-- find more here: https://www.nerdfonts.com/cheat-sheet + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = { + ["<C-k>"] = cmp.mapping.select_prev_item(), + ["<C-j>"] = cmp.mapping.select_next_item(), + ["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), + ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), + ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + ["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping. + ["<C-e>"] = cmp.mapping { + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }, + -- Accept currently selected item. If none selected, `select` first item. + -- Set `select` to `false` to only confirm explicitly selected items. + ["<CR>"] = cmp.mapping.confirm { select = true }, + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { + "i", + "s", + }), + ["<S-Tab>"] = 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", + }), + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + -- Kind icons + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind + vim_item.menu = ({ + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]", + })[entry.source.name] + return vim_item + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "nvim_lua" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }, + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + window = { + documentation = cmp.config.window.bordered(), + }, + experimental = { + ghost_text = false, + native_menu = false, + }, +} diff --git a/nvim/lua/user/lsp/handlers.lua b/nvim/lua/user/lsp/handlers.lua new file mode 100644 index 0000000..8de0abd --- /dev/null +++ b/nvim/lua/user/lsp/handlers.lua @@ -0,0 +1,104 @@ +local M = {} + +-- TODO: backfill this to template +M.setup = function() + local signs = { + { name = "DiagnosticSignError", text = "" }, + { name = "DiagnosticSignWarn", text = "" }, + { name = "DiagnosticSignHint", text = "" }, + { name = "DiagnosticSignInfo", text = "" }, + } + + for _, sign in ipairs(signs) do + vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) + end + + local config = { + -- disable virtual text + virtual_text = false, + -- show signs + signs = { + active = signs, + }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + focusable = false, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, + } + + vim.diagnostic.config(config) + + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = "rounded", + }) + + vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = "rounded", + }) +end + +local function lsp_highlight_document(client) + -- Set autocommands conditional on server_capabilities + if client.server_capabilities.documentHighlight then + vim.api.nvim_exec( + [[ + augroup lsp_document_highlight + autocmd! * <buffer> + autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight() + autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references() + augroup END + ]], + false + ) + end +end + +local function lsp_keymaps(bufnr) + local opts = { noremap = true, silent = true } + vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>f", "<cmd>lua vim.diagnostic.open_float()<CR>", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts) + vim.api.nvim_buf_set_keymap( + bufnr, + "n", + "gl", + '<cmd>lua vim.diagnostic.open_float()<CR>', + opts + ) + vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts) + vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]] +end + +M.on_attach = function(client, bufnr) + if client.name == "tsserver" then + client.server_capabilities.documentFormattingProvider = false + end + lsp_keymaps(bufnr) + lsp_highlight_document(client) +end + +local capabilities = vim.lsp.protocol.make_client_capabilities() + +local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") +if not status_ok then + return +end + +M.capabilities = cmp_nvim_lsp.default_capabilities(capabilities) + +return M diff --git a/nvim/lua/user/lsp/init.lua b/nvim/lua/user/lsp/init.lua new file mode 100644 index 0000000..8a84467 --- /dev/null +++ b/nvim/lua/user/lsp/init.lua @@ -0,0 +1,7 @@ +local status_ok, _ = pcall(require, "lspconfig") +if not status_ok then + return +end + +require "user.lsp.mason" +require("user.lsp.handlers").setup() diff --git a/nvim/lua/user/lsp/mason.lua b/nvim/lua/user/lsp/mason.lua new file mode 100644 index 0000000..a2e5384 --- /dev/null +++ b/nvim/lua/user/lsp/mason.lua @@ -0,0 +1,47 @@ +local servers = { + "lua_ls", + "pyright", + "jsonls", +} + +local settings = { + ui = { + border = "none", + icons = { + package_installed = "◍", + package_pending = "◍", + package_uninstalled = "◍", + }, + }, + log_level = vim.log.levels.INFO, + max_concurrent_installers = 4, +} + +require("mason").setup(settings) +require("mason-lspconfig").setup({ + ensure_installed = servers, + automatic_installation = true, +}) + +local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig") +if not lspconfig_status_ok then + return +end + +local opts = {} + +for _, server in pairs(servers) do + opts = { + on_attach = require("user.lsp.handlers").on_attach, + capabilities = require("user.lsp.handlers").capabilities, + } + + server = vim.split(server, "@")[1] + + local require_ok, conf_opts = pcall(require, "user.lsp.settings." .. server) + if require_ok then + opts = vim.tbl_deep_extend("force", conf_opts, opts) + end + + lspconfig[server].setup(opts) +end diff --git a/nvim/lua/user/lsp/null-ls.lua b/nvim/lua/user/lsp/null-ls.lua new file mode 100644 index 0000000..874e19c --- /dev/null +++ b/nvim/lua/user/lsp/null-ls.lua @@ -0,0 +1,19 @@ +local null_ls_status_ok, null_ls = pcall(require, "null-ls") +if not null_ls_status_ok then + return +end + +-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting +local formatting = null_ls.builtins.formatting +-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics +local diagnostics = null_ls.builtins.diagnostics + +null_ls.setup({ + debug = false, + sources = { + formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), + formatting.black.with({ extra_args = { "--fast" } }), + formatting.stylua, + -- diagnostics.flake8 + }, +}) diff --git a/x11/xinitrc b/x11/xinitrc index a62b91e..525cb0c 100755 --- a/x11/xinitrc +++ b/x11/xinitrc @@ -1,4 +1,5 @@ #!/bin/sh X11CONFIG=${X11CONFIG:=${XDG_CONFIG_HOME:+$XDG_CONFIG_HOME/x11}}; X11CONFIG=${X11CONFIG:-$HOME/.config/x11} X11CONFIG=$X11CONFIG $X11CONFIG/xprofile +[ -e $X11CONFIG/xprofile.$(hostname) ] && X11CONFIG=$X11CONFIG $X11CONFIG/xprofile.$(hostname) exec dbus-launch --exit-with-session ${WM:-timmywm} diff --git a/x11/xprofile.T495 b/x11/xprofile.T495 new file mode 100755 index 0000000..0eb2d0c --- /dev/null +++ b/x11/xprofile.T495 @@ -0,0 +1,4 @@ +#!/bin/sh +xinput --set-prop 13 308 -0.5 # make trackpoint accelerate less +xinput --set-prop 12 308 0.3 # make trackpad accelerate more +xinput --set-prop 12 298 0 # don't disable trackpad while typing diff --git a/zsh/zprofile b/zsh/zprofile index cabaa70..209e56a 100755 --- a/zsh/zprofile +++ b/zsh/zprofile @@ -17,6 +17,7 @@ export XDG_CONFIG_HOME="$HOME/.config" export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc" export MBSYNCRC="$XDG_CONFIG_HOME/mbsync/config" export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config" +export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" export X11CONFIG="$XDG_CONFIG_HOME/x11" # Used for X11 scripts export ZDOTDIR="$XDG_CONFIG_HOME/zsh" |