Compare commits

...
This repository has been archived on 2023-06-26. You can view files and clone it, but cannot push or open issues or pull requests.

5 Commits
kde ... master

Author SHA1 Message Date
341db16a6f
Add archive note to README.md 2023-06-26 14:47:36 +01:00
df7e3734e0
More treesitter extensions 2022-07-04 23:22:12 +01:00
878d7869d7
Add LSP and telescope config 2022-07-04 21:44:59 +01:00
8b585ce6cd
Update NAS IP 2022-07-04 21:43:39 +01:00
9b5c910e22
Migrate nvim config to Lua 2022-06-26 23:13:35 +01:00
11 changed files with 318 additions and 120 deletions

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

@ -0,0 +1,4 @@
require("config.core")
require("config.keymap")
require("config.plugins")

View File

@ -1,119 +0,0 @@
set breakindent
set clipboard=unnamedplus
set encoding=utf-8
set expandtab
set hidden
set ignorecase
set listchars=tab:▸\ ,eol
set nocompatible
set nohlsearch
set noshowmode
set relativenumber
set shiftwidth=2
set smartcase
set smarttab
set softtabstop=2
set synmaxcol=150
set tabstop=4
set undofile
set wildmenu
for folder in ['backup', 'swap', 'undo']
if !isdirectory($XDG_CACHE_HOME . '/nvim/' . folder)
call mkdir($XDG_CACHE_HOME . '/nvim/' . folder, 'p')
endif
endfor
set backupdir=$XDG_CACHE_HOME/nvim/backup//
set directory=$XDG_CACHE_HOME/nvim/swap//
set undodir=$XDG_CACHE_HOME/nvim/undo//
filetype plugin on
scriptencoding utf-8
syntax on
" General key mappings
map <Up> <Nop>
map <Down> <Nop>
map <Left> <Nop>
map <Right> <Nop>
no <C-k> <C-w>k
no <C-j> <C-w>j
no <C-h> <C-w>h
no <C-l> <C-w>l
let mapleader = ","
" Visually select the text that was last edited/pasted
nmap gV `[v`]
no ; :
augroup General
au!
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
autocmd bufwritepost init.vim source $MYVIMRC
augroup END
call has('python3')
if empty(glob($XDG_CONFIG_HOME . '/nvim/autoload/plug.vim'))
silent !curl -fLo $XDG_CONFIG_HOME/nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
silent !pip3 install pynvim
augroup Plug
au!
autocmd VimEnter * PlugInstall
" Bubble single lines with vim-unimpaired
nmap <C-Up> [e
nmap <C-Down> ]e
" Bubble multiple lines with vim-unimpaired
vmap <C-Up> [egv
vmap <C-Down> ]egv
autocmd BufReadPost fugitive://* set bufhidden=delete
augroup END
endif
call plug#begin($XDG_DATA_HOME . '/nvim/plugged')
Plug '/usr/bin/fzf'
nnoremap <Leader>p :call fzf#run({ 'sink': 'e' })<CR>
Plug 'dyng/ctrlsf.vim'
Plug 'godlygeek/tabular'
Plug 'itchyny/lightline.vim'
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
let g:limelight_conceal_ctermfg = 'gray'
autocmd! User GoyoEnter Limelight
autocmd! User GoyoLeave Limelight!
Plug 'kana/vim-textobj-user'
Plug 'markonm/traces.vim'
Plug 'mbbill/undotree'
nn <silent> <Leader>u :UndotreeToggle <BAR> :UndotreeFocus<CR>
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'preservim/nerdtree'
nnoremap <leader>n :NERDTreeFocus<CR>
Plug 'rstacruz/vim-closer'
Plug 'sheerun/vim-polyglot'
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
Plug 'terryma/vim-expand-region'
Plug 'tommcdo/vim-exchange'
Plug 'tpope/vim-abolish'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
call plug#end()

View File

@ -0,0 +1,35 @@
local o = vim.opt
local wo = vim.wo
local bo = vim.bo
-- Global dirs
local cachedir = os.getenv("XDG_CACHE_HOME")
o.backupdir = cachedir .. "/nvim/backup/"
o.directory = cachedir .. "/nvim/swap/"
o.undodir = cachedir .. "/nvim/undo/"
-- Global
o.breakindent = true
o.clipboard = "unnamedplus"
o.compatible = false
o.encoding = "utf-8"
o.expandtab = true
o.hidden = true
o.hlsearch = false
o.ignorecase = true
o.laststatus = 2
o.listchars = { eol = '', tab = '', trail = '·' }
o.relativenumber = true
o.shiftwidth = 2
o.showmode = false
o.smartcase = true
o.smarttab = true
o.softtabstop = 2
o.synmaxcol = 150
o.tabstop = 4
o.undofile = true
o.wildmenu = true
-- Window
-- Buffer

View File

@ -0,0 +1,35 @@
local keymap = vim.keymap.set
local opts = { noremap = true, silent = true }
vim.g.mapleader = ","
-- Modes
-- Normal = "n",
-- Insert = "i",
-- Visual = "v",
-- Visual Block = "x",
-- Term = "t",
-- Command = "c"
keymap("n", "<Left>", "<Nop>", opts)
keymap("n", "<Right>", "<Nop>", opts)
keymap("n", "<Up>", "<Nop>", opts)
keymap("n", "<Down>", "<Nop>", opts)
keymap("n", "<C-h>", "<C-w>h", { noremap = true })
keymap("n", "<C-j>", "<C-w>j", { noremap = true })
keymap("n", "<C-k>", "<C-w>k", { noremap = true })
keymap("n", "<C-l>", "<C-w>l", { noremap = true })
keymap("n", "gV", "`[v`]", opts)
keymap("n", ";", ":", { noremap = true })
-- Bubble single lines with vim-unimpaired
keymap("n", "<C-Up>", "[e", opts)
keymap("n", "<C-Down>", "]e", opts)
-- Bubble multiple lines with vim-unimpaired
keymap("v", "<C-Up>", "[egv", opts)
keymap("v", "<C-Down>", "]egv", opts)

View File

@ -0,0 +1,32 @@
require("nvim-lsp-installer").setup({
ensure_installed = {
"bashls",
"cmake",
"cssls",
"dockerls",
"eslint",
"graphql",
"html",
"jsonls",
"tsserver",
"ltex",
"sumneko_lua",
"marksman",
"pylsp",
"rust_analyzer",
"stylelint_lsp",
"vimls",
"lemminx",
"yamlls",
"zls",
},
ui = {
check_outdated_servers_on_open = false,
icons = {
server_installed = "",
server_pending = "",
server_uninstalled = "",
},
},
})

View File

@ -0,0 +1,87 @@
local fn = vim.fn
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
PACKER_BOOTSTRAP = fn.system {
"git",
"clone",
"--depth",
"1",
"https://github.com/wbthomason/packer.nvim",
install_path,
}
print "Installing packer close and reopen Neovim..."
vim.cmd [[packadd packer.nvim]]
end
vim.cmd [[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerSync
augroup end
]]
local status_ok, packer = pcall(require, "packer")
if not status_ok then
return
end
packer.init {
display = {
open_fn = function()
return require("packer.util").float { border = "rounded" }
end,
},
}
return packer.startup(function(use)
-- Utilities
use { "wbthomason/packer.nvim", opt = true }
use { "mbbill/undotree" }
use { "nvim-lua/plenary.nvim" }
use {
"nvim-treesitter/nvim-treesitter",
event = "BufEnter",
run = ":TSUpdate",
config = [[require('config.treesitter')]]
}
use { "tpope/vim-fugitive", event = "User InGitRepo" }
-- Editing
use { "andymass/vim-matchup", after = "nvim-treesitter" }
use { "godlygeek/tabular" }
use { "JoosepAlviste/nvim-ts-context-commentstring", after = "nvim-treesitter" }
use { "kana/vim-textobj-user" }
use { "mg979/vim-visual-multi", branch = "master" }
use { "nvim-treesitter/nvim-treesitter-context", after = "nvim-treesitter" }
use { "nvim-treesitter/nvim-treesitter-textobjects", after = "nvim-treesitter" }
use { "p00f/nvim-ts-rainbow", after = "nvim-treesitter" }
use { "terryma/vim-expand-region" }
use { "tommcdo/vim-exchange", event = "VimEnter" }
use { "tpope/vim-abolish" }
use { "tpope/vim-commentary", event = "VimEnter" }
use { "tpope/vim-repeat", event = "VimEnter" }
use { "tpope/vim-surround", event = "VimEnter" }
use { "windwp/nvim-autopairs", after = "nvim-treesitter" }
use { "windwp/nvim-ts-autotag", after = "nvim-treesitter" }
-- UI
use { "junegunn/goyo.vim" }
use { "junegunn/limelight.vim" }
use { "markonm/traces.vim" }
-- Searching
use { "nvim-telescope/telescope.nvim", after = "nvim-treesitter", config = [[require('config.telescope')]] }
use { "cljoly/telescope-repo.nvim", requires = "telescope.nvim" }
use { "dyng/ctrlsf.vim" }
-- LSP
use { "neovim/nvim-lspconfig" }
use { "williamboman/nvim-lsp-installer", config = [[require('config.lsp')]] }
use { "jose-elias-alvarez/null-ls.nvim" }
if PACKER_BOOTSTRAP then
require("packer").sync()
end
end)

View File

@ -0,0 +1,46 @@
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
return
end
local actions = require("telescope.actions")
telescope.setup({
defaults = {
file_ignore_patterns = { ".git/", "node_modules" },
},
mappings = {
i = {
["<Down>"] = actions.cycle_history_next,
["<Up>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
},
},
extensions = {
repo = {
list = {
fd_opts = {
"--no-ignore-vcs",
},
search_dirs = {
"~/projects",
"~/repos",
"~/workspace",
},
},
},
},
})
telescope.load_extension("repo")
local keymap = vim.keymap.set
local opts = { noremap = true, silent = true }
keymap("n", "<Leader>ff", "<cmd>Telescope find_files<cr>", opts)
keymap("n", "<Leader>fg", "<cmd>Telescope live_grep<cr>", opts)
keymap("n", "<Leader>fb", "<cmd>Telescope buffers<cr>", opts)
keymap("n", "<Leader>fh", "<cmd>Telescope help_tags<cr>", opts)
keymap("n", "<Leader>fr", "<cmd>Telescope repo list<cr>", opts)

View File

@ -0,0 +1,75 @@
require("nvim-treesitter.configs").setup({
ensure_installed = {
"bash",
"c",
"cmake",
"cpp",
"css",
"dockerfile",
"glsl",
"graphql",
"haskell",
"http",
"html",
"java",
"javascript",
"jsdoc",
"json",
"json5",
"latex",
"lua",
"markdown",
"ninja",
"nix",
"org",
"perl",
"php",
"pug",
"python",
"regex",
"rst",
"ruby",
"rust",
"scala",
"scss",
"toml",
"tsx",
"typescript",
"vim",
"yaml",
"zig"
},
ignore_install = {},
highlight = {
enable = true,
disable = {},
},
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
-- Extensions
autotag = { enable = true },
context_commentstring = { enable = true },
matchup = { enable = true },
rainbow = { enable = true },
textobjects = {
select = {
enable = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
},
},
},
})
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"

View File

@ -4,7 +4,7 @@ Requisite=ssh-agent.service
After=ssh-agent.service
[Mount]
What=%u@nas.home:/mnt/library
What=%u@10.0.1.136:/mnt/library
Where=%h/library
Environment="SSH_AUTH_SOCK=/run/user/%U/ssh-agent.socket"
Type=fuse.sshfs

1
.gitignore vendored
View File

@ -3,5 +3,6 @@
.config/configstore
.config/dconf
.config/nvim/autoload/
.config/nvim/plugin/
.config/pulse/
.config/zsh/.zcompdump

View File

@ -2,6 +2,8 @@
User configuration for Arch Linux based systems.
> My environment is now managed with [Nix](https://nixos.org/) and defined in [nix-config](/jordan/nix-config).
| | |
|-|-|
| **Shell:** | zsh |