Neovim and other items
- [neovim] New Neovim configuration - [aerc] Quick hack to reload the inbox - [xmonad] Integrate with XFCE
This commit is contained in:
parent
bacd27a57e
commit
d35326cb51
6 changed files with 256 additions and 9 deletions
|
@ -19,7 +19,11 @@ k = :prev<Enter>
|
||||||
<C-u> = :prev 50%<Enter>
|
<C-u> = :prev 50%<Enter>
|
||||||
<C-b> = :prev 100%<Enter>
|
<C-b> = :prev 100%<Enter>
|
||||||
<PgUp> = :prev -s 100%<Enter>
|
<PgUp> = :prev -s 100%<Enter>
|
||||||
g = :select 0<Enter>
|
|
||||||
|
# Custom keybinding. Allows me to add a custom chord beginning with g (see
|
||||||
|
# below).
|
||||||
|
gg = :select 0<Enter>
|
||||||
|
|
||||||
G = :select -1<Enter>
|
G = :select -1<Enter>
|
||||||
|
|
||||||
J = :next-folder<Enter>
|
J = :next-folder<Enter>
|
||||||
|
@ -53,6 +57,10 @@ $ = :term<space>
|
||||||
n = :next-result<Enter>
|
n = :next-result<Enter>
|
||||||
N = :prev-result<Enter>
|
N = :prev-result<Enter>
|
||||||
|
|
||||||
|
# Custom keybinding. Refreshes the inbox. The mailboxes should probably refresh
|
||||||
|
# automatically, but do not as of 2023-09-01.
|
||||||
|
gI = :cf INBOX<Enter>
|
||||||
|
|
||||||
[view]
|
[view]
|
||||||
q = :close<Enter>
|
q = :close<Enter>
|
||||||
| = :pipe<space>
|
| = :pipe<space>
|
||||||
|
|
237
nvim/init.lua
Normal file
237
nvim/init.lua
Normal file
|
@ -0,0 +1,237 @@
|
||||||
|
HOME = os.getenv("HOME")
|
||||||
|
|
||||||
|
-- Configure the clipboard to access the \"+ and \"* registers
|
||||||
|
-- (not sure why I need this now and didn't before)
|
||||||
|
vim.opt.clipboard = "unnamedplus,unnamed"
|
||||||
|
|
||||||
|
-- Spaces indentation
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
|
||||||
|
-- Show whitespace
|
||||||
|
vim.opt.listchars = "eol:¬,tab:>-,trail:~,extends:>,precedes:<,space:·"
|
||||||
|
|
||||||
|
-- Show line numbers
|
||||||
|
vim.opt.number = true
|
||||||
|
|
||||||
|
-- Default: split right
|
||||||
|
vim.opt.splitright = true
|
||||||
|
|
||||||
|
-- Highlight cursor line
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
|
||||||
|
-- Enable folding
|
||||||
|
vim.opt.foldmethod = "indent"
|
||||||
|
vim.opt.foldlevel = 99
|
||||||
|
|
||||||
|
-- Sane vim split naviagation (via Gaslight blog)
|
||||||
|
vim.api.nvim_set_keymap("n", "<c-j>", "<c-w>j", { noremap = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<c-k>", "<c-w>k", { noremap = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<c-h>", "<c-w>h", { noremap = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<c-l>", "<c-w>l", { noremap = true })
|
||||||
|
|
||||||
|
-- Disable filetype detection
|
||||||
|
-- vim.opt.filetype = "off"
|
||||||
|
|
||||||
|
-- vim-plug
|
||||||
|
vim.cmd([[
|
||||||
|
if empty(glob('~/.vim/autoload/plug.vim'))
|
||||||
|
silent !curl -fLo ~/.config/local/share/nvim/autoload/plug.vim --create-dirs
|
||||||
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||||||
|
endif
|
||||||
|
|
||||||
|
call plug#begin('~/.config/nvim/plugged')
|
||||||
|
Plug 'williamboman/mason.nvim'
|
||||||
|
Plug 'williamboman/mason-lspconfig.nvim'
|
||||||
|
Plug 'neovim/nvim-lspconfig'
|
||||||
|
Plug 'nvim-lualine/lualine.nvim'
|
||||||
|
Plug 'nvim-tree/nvim-web-devicons'
|
||||||
|
Plug 'nvim-lua/plenary.nvim'
|
||||||
|
Plug 'nvim-telescope/telescope.nvim', { 'branch': '0.1.x' }
|
||||||
|
Plug 'nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate' }
|
||||||
|
Plug 'neovim/nvim-lspconfig'
|
||||||
|
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||||
|
Plug 'hrsh7th/cmp-buffer'
|
||||||
|
Plug 'hrsh7th/cmp-path'
|
||||||
|
Plug 'hrsh7th/cmp-cmdline'
|
||||||
|
Plug 'hrsh7th/nvim-cmp'
|
||||||
|
Plug 'hrsh7th/cmp-vsnip'
|
||||||
|
Plug 'hrsh7th/vim-vsnip'
|
||||||
|
Plug 'tpope/vim-fugitive'
|
||||||
|
Plug 'dracula/vim', { 'as': 'dracula' }
|
||||||
|
Plug 'tpope/vim-surround'
|
||||||
|
call plug#end()
|
||||||
|
]])
|
||||||
|
|
||||||
|
require('mason').setup()
|
||||||
|
require('mason-lspconfig').setup()
|
||||||
|
|
||||||
|
require('lualine').setup {
|
||||||
|
{
|
||||||
|
options = { theme = 'dracula' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tabline = {
|
||||||
|
lualine_a = { 'buffers' },
|
||||||
|
lualine_z = { 'tabs' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||||
|
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
||||||
|
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
||||||
|
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
-- nvim-lspconfig --
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
-- Setup language servers.
|
||||||
|
local lua_ls_setup = {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = "LuaJIT",
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
},
|
||||||
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
lspconfig.gopls.setup {capabilities = capabilities}
|
||||||
|
lspconfig.lua_ls.setup(lua_ls_setup)
|
||||||
|
lspconfig.pyright.setup {capabilities = capabilities}
|
||||||
|
lspconfig.tsserver.setup {capabilities = capabilities}
|
||||||
|
lspconfig.rust_analyzer.setup {
|
||||||
|
-- Server-specific settings. See `:help lspconfig-setup`
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
['rust-analyzer'] = {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Global mappings.
|
||||||
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||||
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
|
-- Use LspAttach autocommand to only map the following keys
|
||||||
|
-- after the language server attaches to the current buffer
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||||
|
callback = function(ev)
|
||||||
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
|
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||||
|
|
||||||
|
-- Buffer local mappings.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
local opts = { buffer = ev.buf }
|
||||||
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||||
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||||
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||||
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||||
|
-- This setting steps on my split navigation setting, so I changed it
|
||||||
|
-- to the probably harmless F9.
|
||||||
|
-- vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||||
|
vim.keymap.set('n', '<F9>', vim.lsp.buf.signature_help, opts)
|
||||||
|
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||||
|
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
|
vim.keymap.set('n', '<space>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||||
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||||
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||||
|
vim.keymap.set('n', '<space>f', function()
|
||||||
|
vim.lsp.buf.format { async = true }
|
||||||
|
end, opts)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Set up nvim-cmp.
|
||||||
|
local cmp = require'cmp'
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
-- REQUIRED - you must specify a snippet engine
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
-- completion = cmp.config.window.bordered(),
|
||||||
|
-- documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
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 }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'vsnip' }, -- For vsnip users.
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Set configuration for specific filetype.
|
||||||
|
cmp.setup.filetype('gitcommit', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline({ '/', '?' }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- 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' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Switch syntax highlighting on
|
||||||
|
vim.cmd("syntax enable")
|
||||||
|
|
||||||
|
-- Set color scheme
|
||||||
|
vim.cmd("colorscheme dracula")
|
||||||
|
|
||||||
|
-- Temporary file locations
|
||||||
|
vim.opt.backupdir = ".backup/," .. HOME .. "/.backup/,/tmp//"
|
||||||
|
vim.opt.directory = ".swp/," .. HOME .. "/.swp/,/tmp//"
|
|
@ -103,14 +103,13 @@ let g:airline#extensions#tabline#enabled = 1
|
||||||
|
|
||||||
" ALE
|
" ALE
|
||||||
let g:ale_linters = {
|
let g:ale_linters = {
|
||||||
\ 'go': ['gofmt', 'golangci-lint', 'gopls', 'govet'],
|
|
||||||
\ 'haskell': ['hlint', 'hdevtools'],
|
\ 'haskell': ['hlint', 'hdevtools'],
|
||||||
\}
|
\}
|
||||||
|
|
||||||
noremap <F7> :ALEFindReferences<CR>
|
nnoremap <F7> :ALEFindReferences<CR>
|
||||||
|
|
||||||
" YouCompleteMe
|
" YouCompleteMe
|
||||||
noremap <F8> :YcmCompleter GoTo<CR>
|
nnoremap <F8> :YcmCompleter GoTo<CR>
|
||||||
|
|
||||||
" YouCompleteMe <> TypeScript
|
" YouCompleteMe <> TypeScript
|
||||||
if !exists("g:ycm_semantic_triggers")
|
if !exists("g:ycm_semantic_triggers")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
/usr/sbin/keepassxc &
|
/usr/sbin/keepassxc &
|
||||||
sleep 16
|
sleep 9
|
||||||
|
|
||||||
/usr/sbin/cbatticon &
|
/usr/sbin/cbatticon &
|
||||||
/usr/sbin/nextcloud &
|
/usr/sbin/nextcloud &
|
||||||
|
|
|
@ -5,6 +5,7 @@ import XMonad.Hooks.EwmhDesktops
|
||||||
import XMonad.Util.EZConfig
|
import XMonad.Util.EZConfig
|
||||||
import XMonad.Util.Loggers
|
import XMonad.Util.Loggers
|
||||||
import XMonad.Util.Ungrab
|
import XMonad.Util.Ungrab
|
||||||
|
import XMonad.Config.Xfce
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = xmonad
|
main = xmonad
|
||||||
|
@ -14,14 +15,16 @@ main = xmonad
|
||||||
toggleStrutsKey :: XConfig Layout -> (KeyMask, KeySym)
|
toggleStrutsKey :: XConfig Layout -> (KeyMask, KeySym)
|
||||||
toggleStrutsKey XConfig{ modMask = m } = (m, xK_b)
|
toggleStrutsKey XConfig{ modMask = m } = (m, xK_b)
|
||||||
|
|
||||||
myConfig = def
|
myConfig = xmonad xfceConfig
|
||||||
{ borderWidth = 4
|
{ borderWidth = 4
|
||||||
, terminal = "/home/adam/.local/bin/alacritty"
|
, terminal = "/home/adam/.local/bin/alacritty"
|
||||||
, modMask = mod4Mask
|
, modMask = mod4Mask
|
||||||
, focusedBorderColor = "#ff00ff"
|
, focusedBorderColor = "#ff00ff"
|
||||||
}
|
}
|
||||||
`additionalKeysP`
|
`additionalKeysP`
|
||||||
[ ("M-S-<Return>", spawn "/home/adam/.local/bin/alacritty msg create-window || /home/adam/.local/bin/alacritty") ]
|
[ ("M-S-<Return>", spawn "/home/adam/.local/bin/alacritty msg create-window || /home/adam/.local/bin/alacritty")
|
||||||
|
, ("M-S-q", spawn "xfce4-session-logout")
|
||||||
|
]
|
||||||
|
|
||||||
myXmobarPP :: PP
|
myXmobarPP :: PP
|
||||||
myXmobarPP = def
|
myXmobarPP = def
|
||||||
|
|
|
@ -21,8 +21,8 @@ export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$HOME/.cargo/env:$HOME/code/go/bi
|
||||||
# export EDITOR='mvim'
|
# export EDITOR='mvim'
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
export EDITOR="vim"
|
export EDITOR="nvim"
|
||||||
export VISUAL="vim"
|
export VISUAL="nvim"
|
||||||
|
|
||||||
# Compilation flags
|
# Compilation flags
|
||||||
# export ARCHFLAGS="-arch x86_64"
|
# export ARCHFLAGS="-arch x86_64"
|
||||||
|
|
Loading…
Reference in a new issue