From 0cc4ce2e14449b3001374b091e569292885d6132 Mon Sep 17 00:00:00 2001 From: Brieuc Dubois Date: Sat, 23 Mar 2024 14:36:40 +0100 Subject: [PATCH] nvim plugins & hyprland bindings --- .../.config/coc/extensions/package.json | 7 +- root/home/bhasher/.config/hypr/src/binds.conf | 4 + .../bhasher/.config/hypr/src/configs.conf | 5 - .../bhasher/.config/hypr/src/windows.conf | 1 - root/home/bhasher/.config/nvim/init.lua | 137 ++++++++++++++---- 5 files changed, 121 insertions(+), 33 deletions(-) diff --git a/root/home/bhasher/.config/coc/extensions/package.json b/root/home/bhasher/.config/coc/extensions/package.json index feb69ef..d6149fd 100644 --- a/root/home/bhasher/.config/coc/extensions/package.json +++ b/root/home/bhasher/.config/coc/extensions/package.json @@ -1 +1,6 @@ -{"dependencies":{}} \ No newline at end of file +{ + "dependencies": { + "coc-json": ">=1.9.2", + "coc-tsserver": ">=2.1.4" + } +} \ No newline at end of file diff --git a/root/home/bhasher/.config/hypr/src/binds.conf b/root/home/bhasher/.config/hypr/src/binds.conf index 621b96f..c003e0c 100644 --- a/root/home/bhasher/.config/hypr/src/binds.conf +++ b/root/home/bhasher/.config/hypr/src/binds.conf @@ -42,6 +42,10 @@ bind = $mainMod SHIFT, underscore, movetoworkspace, 8 bind = $mainMod SHIFT, ccedilla, movetoworkspace, 9 bind = $mainMod SHIFT, agrave, movetoworkspace, 10 +# Move active workspace to neighboring monitor with mainMod + SHIFT + arrow keys +bind = $mainMod SHIFT, left, movecurrentworkspacetomonitor, l +bind = $mainMod SHIFT, right, movecurrentworkspacetomonitor, r + # Example special workspace (scratchpad) bind = $mainMod, S, togglespecialworkspace, magic bind = $mainMod SHIFT, S, movetoworkspace, special:magic diff --git a/root/home/bhasher/.config/hypr/src/configs.conf b/root/home/bhasher/.config/hypr/src/configs.conf index 2b1866b..0281d3a 100644 --- a/root/home/bhasher/.config/hypr/src/configs.conf +++ b/root/home/bhasher/.config/hypr/src/configs.conf @@ -85,8 +85,3 @@ misc { force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers } -# Example per-device config -# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more -device:epic-mouse-v1 { - sensitivity = -0.5 -} diff --git a/root/home/bhasher/.config/hypr/src/windows.conf b/root/home/bhasher/.config/hypr/src/windows.conf index b26ff4f..6ad83fb 100644 --- a/root/home/bhasher/.config/hypr/src/windows.conf +++ b/root/home/bhasher/.config/hypr/src/windows.conf @@ -1,3 +1,2 @@ windowrulev2 = idleinhibit fullscreen, fullscreen:1 windowrulev2 = tile, class:^(ONLYOFFICE Desktop Editors)$ -windowrulev2 = nomaximizerequest, class:.* diff --git a/root/home/bhasher/.config/nvim/init.lua b/root/home/bhasher/.config/nvim/init.lua index ca0bd1c..b27f0d9 100644 --- a/root/home/bhasher/.config/nvim/init.lua +++ b/root/home/bhasher/.config/nvim/init.lua @@ -14,42 +14,127 @@ vim.opt.expandtab = false vim.opt.number = true vim.opt.relativenumber = true -vim.opt.wildmode = 'longest,list' +vim.opt.wildmode = "longest,list" -vim.opt.syntax = 'on' +vim.opt.syntax = "on" vim.opt.ttyfast = true vim.opt.swapfile = false -vim.opt.mouse = 'a' +vim.opt.mouse = "a" vim.opt.spell = true -vim.opt.spelllang = 'en' -- ,fr' -vim.api.nvim_set_hl(0, "SpellBad", { ctermbg=238 }) +vim.opt.spelllang = "en" -- ,fr' +vim.api.nvim_set_hl(0, "SpellBad", { ctermbg = 238 }) + +vim.cmd([[colorscheme desert]]) -- Plugins -local Plug = vim.fn['plug#'] -vim.call('plug#begin') +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -Plug('neoclide/coc.nvim', {['branch'] = 'release'}) -Plug('francoiscabrol/ranger.vim') -Plug('rbgrouleff/bclose.vim') --- Plug('zbirenbaum/copilot.lua') -Plug('github/copilot.vim') -Plug('nvim-treesitter/nvim-treesitter', {['do'] = ':TSUpdate'}) +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + "--depth=1", + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) -vim.call('plug#end') - --- inoremap coc#pum#visible() ? coc#pum#confirm() --- \: "\u\\=coc#on_enter()\" - -vim.g.ranger_replace_netrw = 1 -vim.keymap.set('i', '', '(copilot-accept-word)') - -require('nvim-treesitter.configs').setup({ - ensure_installed = { "go", "lua", "vim", "vimdoc", "sql", "json", }, - highlight = { - enable = true, - }, +require("lazy").setup({ + { + -- Auto completion + "neoclide/coc.nvim", + branch = "release", + }, + { + -- LSP + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + }, + { + -- Copilot + "github/copilot.vim", + --config = function() + -- require("copilot.vim").setup({ + -- filetypes = { + -- ["."] = true, + -- } + -- }) + -- end, + }, + { + -- Ranger file explorer + "kelly-lin/ranger.nvim", + config = function() + require("ranger-nvim").setup({ replace_netrw = true }) + end, + }, + { + -- Formatter + "stevearc/conform.nvim", + opts = {}, + }, + { + -- Auto pairs + "altermo/ultimate-autopair.nvim", + event = { "InsertEnter", "CmdlineEnter" }, + branch = "v0.6", --recommended as each new version will have breaking changes + opts = {}, + }, }) +require("conform").setup({ + formatters_by_ft = { + lua = { "stylua" }, + python = { "black" }, + javascript = { "prettier" }, + typescript = { "prettier" }, + svelte = { "prettier" }, + html = { "prettier" }, + css = { "prettier" }, + md = { "prettier" }, + less = { "prettier" }, + scss = { "prettier" }, + json = { "prettier" }, + yaml = { "prettier" }, + toml = { "prettier" }, + java = { "google-java-format" }, + }, + format_on_save = {}, +}) + +require("nvim-treesitter.configs").setup({ + ensure_installed = { "go", "lua", "vim", "vimdoc", "sql", "json", "javascript", "typescript", "svelte", "html", "java", "markdown" }, + highlight = { + enable = true, + }, + autotag = { + enable = true, + }, +}) + + +-- mappings +vim.keymap.set("i", "", "(copilot-accept-word)") +vim.keymap.set( + "i", + "", + "coc#pum#visible() ? coc#pum#next(1): ''", + { noremap = true, silent = true, expr = true } +) + +-- commands +vim.api.nvim_create_user_command("Day", function(opts) + vim.cmd([[colorscheme delek]]) +end, { nargs = 0 }) + +vim.api.nvim_create_user_command("Night", function(opts) + vim.cmd([[colorscheme desert]]) +end, { nargs = 0 }) + +-- Abc