Move things and add script to auto copy config files

This commit is contained in:
Leon Grünewald 2021-08-29 18:37:58 +02:00
parent cae9ec5030
commit f85dc5cce3
8 changed files with 182 additions and 49 deletions

View file

@ -2,22 +2,24 @@ source ~/.vimrc
set inccommand=nosplit set inccommand=nosplit
lua << EOF lua << EOF
require'lspconfig'.phpactor.setup{}
require'lspconfig'.vuels.setup{}
require'lspconfig'.vimls.setup{}
local nvim_lsp = require('lspconfig') local nvim_lsp = require('lspconfig')
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings. -- Mappings.
local opts = { noremap=true, silent=true } local opts = { noremap=true, silent=true }
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts) -- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts) buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
@ -25,38 +27,25 @@ buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts) buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts) buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts) buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
-- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
elseif client.resolved_capabilities.document_range_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end end
-- Set autocommands conditional on server_capabilities -- Use a loop to conveniently call 'setup' on multiple servers and
if client.resolved_capabilities.document_highlight then -- map buffer local keybindings when the language server attaches
vim.api.nvim_exec([[ local servers = { "html", "clangd", "vimls", "vuels", "phpactor", "rust_analyzer", "tsserver" }
hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
hi LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
hi LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow
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
-- Use a loop to conveniently both setup defined servers
-- and map buffer local keybindings when the language server attaches
local servers = { "pyright", "rust_analyzer", "tsserver" }
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup { on_attach = on_attach } nvim_lsp[lsp].setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
}
}
end end
EOF EOF

View file

@ -1 +0,0 @@
README.md.html

142
keynavrc Normal file
View file

@ -0,0 +1,142 @@
# This is a keynavrc file. Yours should live in
# $HOME/.config/keynav/keynavrc
#
# Lines beginning with '#' are comments.
# Format is:
# keysequence cmd1,cmd2,cmd3...
#
# Other special values are:
# 'clear' on a line by itself (no quotes) will erase all keybindings
# (including the defaults)
# 'daemonize' on a line by itself (no quotes) will make keynav background
# after parsing the configfile and having no critical errors.
#
# The 'start' command alone is handled specially, in that any key sequence
# mapped to 'start' will be grabbed when keynav starts up so you can invoke it
# to activate keynav. The remaining keys are only recognized while keynav is
# active
#
# Project page; http://www.semicomplete.com/projects/keynav
# Use 'clear' to blow away any previous keybindings
#clear
# Use 'daemonize' to background ourselves.
daemonize
ctrl+semicolon start
Escape end
#ctrl+bracketleft end
h cut-left
j cut-down
k cut-up
l cut-right
y cut-left,cut-up
u cut-right,cut-up
b cut-left,cut-down
n cut-right,cut-down
shift+h move-left
shift+j move-down
shift+k move-up
shift+l move-right
shift+y move-left,move-up
shift+u move-right,move-up
shift+b move-left,move-down
shift+n move-right,move-down
space warp,click 1,end
semicolon warp,end
1 click 1
2 click 2
3 click 3
# Zoom to the current window
w windowzoom
# Zoom to the cursor location with a given height and width
c cursorzoom 200 200
# Handy for holding ctrl while using keynav:
ctrl+h cut-left
ctrl+j cut-down
ctrl+k cut-up
ctrl+l cut-right
ctrl+y cut-left,cut-up
ctrl+u cut-right,cut-up
ctrl+b cut-left,cut-down
ctrl+n cut-right,cut-down
# Arrow keys can move the grid as welll
Left cut-left
Down cut-down
Up cut-up
Right cut-right
shift+Left move-left
shift+Down move-down
shift+Up move-up
shift+Right move-right
ctrl+Left cut-left
ctrl+Down cut-down
ctrl+Up cut-up
ctrl+Right cut-right
ctrl+shift+Left move-left
ctrl+shift+Down move-down
ctrl+shift+Up move-up
ctrl+shift+Right move-right
# Record keynav actions
q record
shift+at playback
### Example using the 'sh' command.
# Make firefox the active window
#f sh "xdotool windowactivate $(xdotool search -title -- '- Mozilla Firefox')", end
# Make a new tab in google chrome:
#t sh "xdotool windowactivate $(xdotool search --title -- '- Google Chrome' | head -1); xdotool key ctrl+t",end
# Paste
#v sh "xdotool key shift+Insert"
### Drag examples
# Start drag holding the left mouse button
#q drag 1
# Start drag holding middle mouse + control and shift
#w drag 2 ctrl+shift
# Dragging with modifiers
#q drag 1
#ctrl+q drag 1 ctrl
#shift+q drag 1 shift
#shift+ctrl+q drag 1 shift+ctrl
### History
a history-back
### Example of cut and move without the default values
#h cut-left .75
#j cut-down .75
#k cut-up .75
#l cut-right .75
#shift+h move-left .50
#shift+j move-down .50
#shift+k move-up .50
#shift+l move-right .50
### Example using a 2-row, 3-column grid,
# mapped to Insert/Home/PageUp/etc...
#6 grid 2x3
#Insert cell-select 1x1
#Home cell-select 1x2
#Prior cell-select 1x3 # PageUp
#Delete cell-select 2x1
#End cell-select 2x2
#Next cell-select 2x3 # PageDown
### Example using a 3x3 grid with nethack-vi keys
#ctrl+semicolon start, grid 3x3
#h cell-select 1x2 # left
#j cell-select 2x3 # down
#k cell-select 2x1 # up
#l cell-select 3x2 # right
#y cell-select 1x1 # up-left
#u cell-select 3x1 # up-right
#b cell-select 1x3 # down-left
#n cell-select 3x3 # down-right
#period cell-select 2x2 # center

3
tools/sync.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
find ./ -type f -not -path './.git/*' | sed -e 's/^.\///' | xargs -i{} -n1 cp ~/{} ./{} -rf