Compare commits

...

5 Commits

Author SHA1 Message Date
7b4c3a3f3a
nvim: use buffer local and maplocalleader for binds 2024-04-05 12:26:39 -04:00
b1709910dc
nvim: use tab for system clipboard binds 2024-04-05 12:18:17 -04:00
166437f644
nvim: merge remaining VimL configs back into init.vim
also removed digraphs config.
run :digraphs for a list of built-in digraphs
2024-04-05 12:13:19 -04:00
40700d7b0e
qutebrowser: format config.py 2024-04-05 12:04:34 -04:00
db835d9628
nvim: nvim-treesitter-text-objects plugin added 2024-04-04 22:17:16 -04:00
8 changed files with 99 additions and 90 deletions

4
.gitmodules vendored
View File

@ -48,6 +48,10 @@
[submodule "src/.local/share/nvim/site/pack/3pp/start/nvim-treesitter"]
path = src/.local/share/nvim/site/pack/3pp/start/nvim-treesitter
url = https://github.com/nvim-treesitter/nvim-treesitter.git
# intelligent motions based on treesitter
[submodule "src/.local/share/nvim/site/pack/3pp/start/nvim-treesitter-textobjects"]
path = src/.local/share/nvim/site/pack/3pp/start/nvim-treesitter-textobjects
url = https://github.com/nvim-treesitter/nvim-treesitter-textobjects
# error/warning/info box
# coding.lua

View File

@ -1,11 +0,0 @@
" configurations for coding
" -------------------------
" Code folding
set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()
" unfold by default
set foldlevel=99
" auto-pairs
let g:AutoPairsFlyMode = 0

View File

@ -1,30 +0,0 @@
" see :help digraphs
" these digraphs are reminiscent of canadian french keyboard layout
if exists("*digraph_setlist")
call digraph_setlist([
\["'a", 'à'],
\["'e", 'è'],
\["'u", 'ù'],
\["/e", 'é'],
\["}a", 'ä'],
\["}e", 'ë'],
\["}i", 'ï'],
\["}o", 'ö'],
\["}u", 'ü'],
\["}y", 'ÿ'],
\["]c", 'ç'],
\["[a", 'â'],
\["[e", 'ê'],
\["[i", 'î'],
\["[o", 'ô'],
\["[u", 'û'],
\])
" misc funny digraphs
call digraph_setlist([
\["++", '✝'],
\["+-", '†'],
\["m-", '—'],
\])
end

View File

@ -11,7 +11,7 @@ au TermOpen * setlocal nonumber norelativenumber
tnoremap <silent> <esc> <c-\><c-n><c-\><c-n>
" sign column on top of the line number (gutter for things like breakpoints, warnings)
" set scl=number
set scl=number
" enable line numbers
set number relativenumber
@ -23,7 +23,11 @@ set showtabline=0
" performance?
set lazyredraw nocursorline ttyfast
" disable splash screen
set shortmess+=I
let mapleader = ","
let maplocalleader = " "
" " use system clipboard instead of internal
" set clipboard=unnamedplus
@ -34,12 +38,12 @@ let mapleader = ","
" vnoremap s "-s
" easier binds to use system clipboard with
nmap <leader>y "+y
vmap <leader>y "+y
" <leader>d is for debugging
" and nobody uses clipboard c amirite or amirite
nmap <leader>c "+d
vmap <leader>c "+d
nmap <tab>y "+y
vmap <tab>y "+y
nmap <tab>d "+d
vmap <tab>d "+d
nmap <tab>c "+c
vmap <tab>c "+c
set shell=/bin/sh
@ -55,9 +59,6 @@ highlight LineNr ctermfg=grey
" Disable highlighting when searching
nnoremap <silent> <esc> :noh<return><esc>
" shortcuts to type symbols easier
source $XDG_CONFIG_HOME/nvim/digraphs.vim
" tab, window management
set splitbelow splitright
nnoremap <C-j> <C-w>w
@ -70,17 +71,11 @@ nnoremap <silent> ZF :qa<cr>
" see .config/nvim/lua/init.lua
lua require('init')
" The rest will not be sourced if the system is on minimal settings.
if $SYSTEM_PROFILE == "MINIMAL"
finish
endif
" Code folding
set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()
" unfold by default
set foldlevel=99
filetype plugin indent on
if $SYSTEM_PROFILE == "DEFAULT"
" plugins for IDE-like nvim
source $XDG_CONFIG_HOME/nvim/coding.vim
endif
" personal preference
set shortmess+=I
" auto-pairs
let g:AutoPairsFlyMode = 0

View File

@ -33,7 +33,7 @@ vim.api.nvim_create_autocmd(
-- plug: nvim-treesitter
------
require 'nvim-treesitter.configs'.setup {
ensure_installed = { "c", "cpp", "javascript", "typescript", "python", "vim", "fish", "bash" },
ensure_installed = { "c", "cpp", "javascript", "typescript", "python", "vim", "fish", "bash", "lua", "rust" },
sync_install = false,
auto_install = false,
highlight = {
@ -49,6 +49,25 @@ require 'nvim-treesitter.configs'.setup {
},
}
------
-- treesitter (language intelligent) motions
-- plug: nvim-treesitter-textobjects
------
require("nvim-treesitter.configs").setup {
textobjects = {
select = {
enable = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
}
}
}
------
-- diagnostics box
@ -56,8 +75,8 @@ require 'nvim-treesitter.configs'.setup {
------
require('trouble').setup({
icons = false,
fold_open = "v", -- icon used for open folds
fold_closed = ">", -- icon used for closed folds
fold_open = "v", -- icon used for open folds
fold_closed = ">", -- icon used for closed folds
indent_lines = false, -- add an indent guide below the fold icons
signs = {
-- icons / text used for a diagnostic
@ -92,21 +111,21 @@ local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
local opts = { noremap = true, silent = true }
local opts = { noremap = true, silent = true, buffer=bufnr }
keymap('gD', vim.lsp.buf.declaration, opts)
keymap('gd', vim.lsp.buf.definition, opts)
keymap('gK', vim.lsp.buf.hover, opts)
keymap('gi', vim.lsp.buf.implementation, opts)
keymap('gs', vim.lsp.buf.signature_help, opts)
keymap('gt', vim.lsp.buf.type_definition, opts)
keymap('<space>rn', vim.lsp.buf.rename, opts)
keymap('<space>ss', vim.lsp.buf.workspace_symbol, opts)
keymap('<localleader>rn', vim.lsp.buf.rename, opts)
keymap('<localleader>ss', vim.lsp.buf.workspace_symbol, opts)
keymap('gr', vim.lsp.buf.references, opts)
keymap('<space>e', vim.lsp.diagnostic.show_line_diagnostics, opts)
keymap('<localleader>e', vim.lsp.diagnostic.show_line_diagnostics, opts)
keymap('[d', vim.lsp.diagnostic.goto_prev, opts)
keymap(']d', vim.lsp.diagnostic.goto_next, opts)
keymap('<space>ca', vim.lsp.buf.code_action, opts)
keymap('<space>f', vim.lsp.buf.format, opts)
keymap('<localleader>ca', vim.lsp.buf.code_action, opts)
keymap('<localleader>f', vim.lsp.buf.format, opts)
end
-- table declares LSPs to be set up
@ -140,7 +159,7 @@ local servers = {
},
diagnostics = {
-- get it to stop complaining about luasnip
globals = {'s', 'f', 't', "fmt", "c", "sn", "i", "rep", "d", "k", "events"},
globals = { 's', 'f', 't', "fmt", "c", "sn", "i", "rep", "d", "k", "events" },
},
}
}

View File

@ -17,6 +17,7 @@ function M.keymap(key, cmd, params)
silent = true,
mode = { 'n' },
noremap = true,
buffer = false,
}
setmetatable(params, {
__index = function(table, k)
@ -24,7 +25,12 @@ function M.keymap(key, cmd, params)
end
})
vim.keymap.set(params.mode, key, cmd, { silent = params.silent, noremap = params.noremap, expr = params.expr })
vim.keymap.set(params.mode, key, cmd, {
silent = params.silent,
noremap = params.noremap,
expr = params.expr,
buffer = params.buffer
})
end
-- see ~/.config/dot_profile.example for info

View File

@ -42,13 +42,13 @@ c.fonts.web.family.sans_serif = "Liberation Sans"
c.fonts.web.family.standard = "Liberation Sans"
c.fonts.web.family.fixed = "JetBrains Mono"
config.bind('td', 'config-cycle colors.webpage.darkmode.enabled true false;; restart')
config.bind("td", "config-cycle colors.webpage.darkmode.enabled true false;; restart")
# General settings
c.url.default_page = "~/.config/qutebrowser/homepage.html"
c.url.start_pages = "~/.config/qutebrowser/homepage.html"
c.url.searchengines = {"DEFAULT":"https://searx.be/search?q={}"}
c.url.searchengines = {"DEFAULT": "https://searx.be/search?q={}"}
c.downloads.location.directory = "~/quar/"
c.zoom.default = "100%"
@ -62,7 +62,7 @@ c.downloads.remove_finished = 1000
c.tabs.max_width = 300
c.tabs.position = "top"
c.statusbar.show = "in-mode"
c.statusbar.widgets = [ "keypress", "progress" ]
c.statusbar.widgets = ["keypress", "progress"]
c.tabs.indicator.width = 0
c.tabs.position = "bottom"
c.tabs.title.format = "{audio}{current_title}"
@ -98,9 +98,13 @@ c.content.cookies.accept = "no-3rdparty"
c.content.cookies.store = False
# Less unique headers compared to the defaults
c.content.headers.user_agent = "Mozilla/5.0 (Android 10; Mobile; rv:91.0) Gecko/91.0 Firefox/91.0"
c.content.headers.user_agent = (
"Mozilla/5.0 (Android 10; Mobile; rv:91.0) Gecko/91.0 Firefox/91.0"
)
c.content.headers.accept_language = "en-US,en;q=0.5"
c.content.headers.custom = {"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"}
c.content.headers.custom = {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
}
# Sending a Do Not Track header makes your fingerprint more unique according to Panopticlick,
# and I don't trust sites to respect it, so I think it's better to not include it at all.
# (True: send DNT, False: Send DNT header set to 0, None: Don't send DNT)
@ -118,10 +122,7 @@ config.bind(";I", "hint images yank")
config.bind("p", "open -t {clipboard}")
# code block copying
c.hints.selectors["code"] = [
":not(pre) > code",
"pre"
]
c.hints.selectors["code"] = [":not(pre) > code", "pre"]
config.bind("cc", "hint code userscript code_select.py")
# copy the title
@ -143,13 +144,37 @@ config.bind("<escape>", "clear-messages;; search")
# homegrown file selector
c.fileselect.handler = "external"
c.fileselect.multiple_files.command = ["st", "-e", "fish", "-C", "set -x OUTPUT {}; source ~/.local/bin/fish-fm"]
c.fileselect.single_file.command = ["st", "-e", "fish", "-C", "set -x OUTPUT {}; source ~/.local/bin/fish-fm"]
c.fileselect.multiple_files.command = [
"st",
"-e",
"fish",
"-C",
"set -x OUTPUT {}; source ~/.local/bin/fish-fm",
]
c.fileselect.single_file.command = [
"st",
"-e",
"fish",
"-C",
"set -x OUTPUT {}; source ~/.local/bin/fish-fm",
]
# smooth scroll for larger increments
# (thank you very much dima https://github.com/qutebrowser/qutebrowser/issues/6281)
config.bind("<Ctrl-d>", "jseval -q window.scrollBy({top: window.innerHeight/2, left: 0, behavior: 'smooth'});")
config.bind("<Ctrl-u>", "jseval -q window.scrollBy({top: -window.innerHeight/2, left: 0, behavior: 'smooth'});")
config.bind("G", "jseval -q window.scrollBy({top: document.body.scrollHeight + 1e6, left: 0, behavior: 'smooth'});")
config.bind("gg", "jseval -q window.scrollBy({top: -document.body.scrollHeight - 1e6, left: 0, behavior: 'smooth'});")
config.bind(
"<Ctrl-d>",
"jseval -q window.scrollBy({top: window.innerHeight/2, left: 0, behavior: 'smooth'});",
)
config.bind(
"<Ctrl-u>",
"jseval -q window.scrollBy({top: -window.innerHeight/2, left: 0, behavior: 'smooth'});",
)
config.bind(
"G",
"jseval -q window.scrollBy({top: document.body.scrollHeight + 1e6, left: 0, behavior: 'smooth'});",
)
config.bind(
"gg",
"jseval -q window.scrollBy({top: -document.body.scrollHeight - 1e6, left: 0, behavior: 'smooth'});",
)
c.scrolling.smooth = True

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