new config for wsl2

This commit is contained in:
juancwu 2023-07-02 20:19:21 -04:00 committed by Jc
commit 108c9c97d5
24 changed files with 62 additions and 447 deletions

View file

@ -1,6 +1,6 @@
#x-server #x-server
set -g DISPLAY $(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0 #set -g DISPLAY $(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
#
if test -x (command -v npiperelay.exe) #if test -x (command -v npiperelay.exe)
source (dirname (status --current-file))/config-npiperelay.fish # source (dirname (status --current-file))/config-npiperelay.fish
end #end

View file

@ -1,7 +0,0 @@
local status, autopairs = pcall(require, "nvim-autopairs")
if not status then return end
autopairs.setup({
disable_filetype = { "TelescopePrompt", "vim" }
})

View file

@ -1,5 +0,0 @@
local status, autotag = pcall(require, "nvim-ts-autotag")
if not status then return end
autotag.setup()

View file

@ -1,9 +0,0 @@
local status, colorizer = pcall(require, 'colorizer')
if not status then return end
colorizer.setup({
'*';
})

View file

@ -1,27 +0,0 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
local juancwu_fugitive = vim.api.nvim_create_augroup("juancwu_fugitive", {})
vim.api.nvim_create_autocmd("BufWinEnter", {
group = juancwu_fugitive,
pattern = "*",
callback = function()
if vim.bo.ft ~= "fugitive" then
return
end
local bufnr = vim.api.nvim_get_current_buf()
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "<leader>p", function ()
vim.cmd.Git("push")
end, opts)
vim.keymap.set("n", "<leader>P", function ()
vim.cmd.Git({"pull", "--rebase"})
end, opts)
-- setup an upstream for first pushes to a branch
vim.keymap.set("n", "<leader>u", ":Git push -u origin ", opts)
end
})

View file

@ -1,17 +0,0 @@
local status, mark = pcall(require, "harpoon.mark")
if not status then return end
local status, ui = pcall(require, "harpoon.ui")
if not status then return end
vim.keymap.set("n", "<leader>a", mark.add_file)
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
vim.keymap.set("n", "<leader>q", function() ui.nav_file(1) end)
vim.keymap.set("n", "<leader>w", function() ui.nav_file(2) end)
vim.keymap.set("n", "<leader>e", function() ui.nav_file(3) end)
vim.keymap.set("n", "<leader>r", function() ui.nav_file(4) end)
vim.keymap.set("n", "<leader>,", ui.nav_prev)
vim.keymap.set("n", "<leader>.", ui.nav_next)

View file

@ -1,10 +0,0 @@
local status, lsp = pcall(require, "lsp-zero")
if not status then return end
lsp.preset("recommended")
lsp.setup()
lsp.on_attach(function(_, buffnr)
vim.keymap.set("n", "<C-s>", vim.lsp.buf.signature_help, { buffer = buffnr })
end)

View file

@ -0,0 +1,12 @@
local status, lspzero = pcall(require, "lsp-zero")
if not status then return end
lspzero.preset("recommended")
-- first argument is the client
lspzero.on_attach(function(_, bufnr)
lspzero.default_keymaps({buffer = bufnr})
end)
lspzero.setup()

View file

@ -1,53 +0,0 @@
local status, lualine = pcall(require, 'lualine')
if (not status) then return end
lualine.setup {
options = {
icons_enabled = true,
theme = 'onedark',
section_separators = {
left = '',
right = ''
},
component_separators = {
left = '',
right = ''
},
disabled_filetypes = {}
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch' },
lualine_c = { {
'filename',
file_status = true, -- display file status
path = 0 -- no file path
} },
lualine_x = {
{
'diagnostics',
sources = { 'nvim_diagnostic' },
symbols = { error = '', warn = '', info = '', hint = '' }
},
'enconding',
'filetype'
},
lualine_y = { 'progress' },
lualine_z = { 'location' }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { {
'filename',
file_status = true,
path = 1
} },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {}
},
tabline = {},
extensions = { 'fugitive' }
}

View file

@ -1,18 +0,0 @@
local juancwu_markdown = vim.api.nvim_create_augroup("juancwu_markdown", {})
vim.api.nvim_create_autocmd("BufWinEnter", {
group = juancwu_markdown,
pattern = "*",
callback = function()
if vim.bo.ft ~= "markdown" then
return
end
local bufnr = vim.api.nvim_get_current_buf()
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "<C-m>p", vim.cmd.MarkdownPreview, opts)
vim.keymap.set("n", "<C-m>s", vim.cmd.MarkdownPreviewStop, opts)
vim.keymap.set("n", "<C-m>t", vim.cmd.MarkdownPreviewToggle, opts)
end
})

View file

@ -1,31 +0,0 @@
local status, n = pcall(require, "neosolarized")
if not status then return end
n.setup({ comment_italics = true })
local cb = require("colorbuddy.init")
local Color = cb.Color
local colors = cb.colors
local Group = cb.Group
local groups = cb.groups
local styles = cb.styles
Color.new("black", "#000000")
Group.new("CursorLine", colors.none, colors.base03, styles.NONE, colors.base1)
Group.new("CursorLineNr", colors.yellow, colors.black, styles.NONE, colors.base1)
Group.new("Visual", colors.none, colors.base03, styles.reverse)
-- local cError = groups.Error.fg
-- local cInfo = groups.Information.fg
-- local cWarn = groups.Warning.fg
-- local cHint = groups.Hint.fg
-- Group.new("DiagnosticVirtualTextError", cError, cError:dark():dark():dark():dark(), styles.NONE)
-- Group.new("DiagnosticVirtualTextInfo", cInfo, cInfo:dark():dark():dark(), styles.NONE)
-- Group.new("DiagnosticVirtualTextWarn", cWarn, cWarn:dark():dark():dark(), styles.NONE)
-- Group.new("DiagnosticVirtualTextHint", cHint, cHint:dark():dark():dark(), styles.NONE)
-- Group.new("DiagnosticUnderlineError", colors.none, colors.none, styles.udnercurl, cError)
-- Group.new("DiagnosticUnderlineWarn", colors.none, colors.none, styles.udnercurl, cWarn)
-- Group.new("DiagnosticUnderlineInfo", colors.none, colors.none, styles.udnercurl, cInfo)
-- Group.new("DiagnosticUnderlineHint", colors.none, colors.none, styles.udnercurl, cHint)

View file

@ -1,42 +0,0 @@
local status, null_ls = pcall(require, "null-ls")
if not status then
return
end
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local lsp_formatting = function(bufnr)
vim.lsp.buf.format({
filter = function(client)
return client.name == "null-ls"
end,
bufnr = bufnr,
})
end
null_ls.setup({
sources = {
null_ls.builtins.formatting.prettierd,
null_ls.builtins.formatting.autopep8,
null_ls.builtins.formatting.stylua,
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({
group = augroup,
buffer = bufnr,
})
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
lsp_formatting(bufnr)
end,
})
end
end,
})
vim.api.nvim_create_user_command("DisableLspFormatting", function()
vim.api.nvim_clear_autocmds({ group = augroup, buffer = 0 })
end, { nargs = 0 })

View file

@ -1,13 +0,0 @@
local status, onedark = pcall(require, 'onedark')
if not status then return end
onedark.setup {
style = 'dark',
transparent = true,
lualine = {
transparent = true, -- Set to true when using 'onedark' theme
}
}
onedark.load()

View file

@ -1 +0,0 @@
vim.g.python_pep8_indent_hang_closing = 1 -- format multiline lists and dictionaries, and more

View file

@ -1,63 +0,0 @@
local status, telescope = pcall(require, "telescope")
if not status then return end
local actions = require("telescope.actions")
local builtin = require("telescope.builtin")
local fb_actions = require "telescope".extensions.file_browser.actions
local function telescope_buffer_dir()
return vim.fn.expand("%:p:h")
end
telescope.setup({
defaults = {
mappings = {
n = {
['q'] = actions.close
}
}
},
extensions = {
file_browser = {
theme = "dropdown",
hijack_netrw = true,
hidden = true,
mappings = {
['i'] = {
['<C-w>'] = function() vim.cmd("normal vbd") end
},
['n'] = {
['N'] = fb_actions.create,
['h'] = fb_actions.goto_parent_dir,
['/'] = function() vim.cmd("startinsert") end,
['D'] = fb_actions.remove
}
}
}
}
})
telescope.load_extension("file_browser")
-- Set up keymaps specific to telescope
vim.keymap.set("n", ";f", function()
builtin.find_files({ no_ignore = false, hidden = true })
end)
vim.keymap.set("n", ";g", builtin.git_files)
vim.keymap.set("n", "sf",
function()
telescope.extensions.file_browser.file_browser({
path = "%:p:h",
cwd = telescope_buffer_dir(),
respect_gitignore = true,
hidden = true,
grouped = true,
previewer = false,
initial_mode = "normal",
layout_config = { height = 40 }
})
end)
vim.keymap.set("n", ";h", builtin.help_tags)

View file

@ -1,25 +0,0 @@
local status, treesitter = pcall(require, "nvim-treesitter.configs")
if not status then return end
treesitter.setup {
-- A list of parser names, or "all"
ensure_installed = { "help", "javascript", "typescript", "c", "lua", "rust" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
-- `false` will disable the whole extension
enable = true,
},
indent = {
enable = true,
disable = { "python" }
}
}

View file

@ -1,18 +0,0 @@
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
local has_persistent_undo = vim.api.nvim_call_function("has", { "persistent_undo" })
if has_persistent_undo then
local target_path = vim.api.nvim_call_function("expand", { "~/.undodir" })
local is_directory = vim.api.nvim_call_function("isdirectory", { target_path })
if not is_directory then
vim.api.nvim_call_function("mkdir", { target_path, "p", 0700 })
end
vim.opt.undodir = target_path
vim.opt.undofile = true
end

View file

@ -1,7 +0,0 @@
local status, zen = pcall(require, "zen-mode")
if not status then return end
zen.setup {}
vim.keymap.set("n", "<C-w>o", vim.cmd.ZenMode, { silent = true })

View file

@ -0,0 +1,12 @@
vim.g.clipboard = {
name = "win32yank",
copy = {
['+'] = "win32yank.exe -i --crlf",
['*'] = "win32yank.exe -i --crlf",
},
paste = {
['+'] = "win32yank.exe -o --lf",
['*'] = "win32yank.exe -o --lf",
},
cache_enabled = 0,
}

View file

@ -1,2 +1,4 @@
require("juancwu.keymaps") require("juancwu.keymaps")
require("juancwu.options") require("juancwu.options")
require("juancwu.theme")
require("juancwu.clipboard")

View file

@ -1,7 +1,7 @@
vim.g.mapleader = " " vim.g.mapleader = " "
-- open the explorer -- open the explorer
vim.keymap.set("n", "<leader>pv", "<cmd>Ex<CR>") vim.keymap.set("n", "<leader>e", "<cmd>Ex<CR>")
-- move highlighted lines -- move highlighted lines
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
@ -18,9 +18,6 @@ vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv") vim.keymap.set("n", "N", "Nzzzv")
-- paste without losing clipboard
vim.keymap.set("x", "<leader>p", "\"_dP")
-- do not copy with x, for god sake, WHY copy something that is being deleted?? -- do not copy with x, for god sake, WHY copy something that is being deleted??
vim.keymap.set("n", "x", "\"_x") vim.keymap.set("n", "x", "\"_x")
@ -36,8 +33,7 @@ vim.keymap.set("n", "<leader>dd", "dd") -- cut line, under my control
-- copy/paste to/from system clipboard -- copy/paste to/from system clipboard
vim.keymap.set({"n", "v"}, "<leader>y", "\"+y") vim.keymap.set({"n", "v"}, "<leader>y", "\"+y")
vim.keymap.set("n", "<leader>Y", "\"+Y") vim.keymap.set({"n", "v"}, "<leader>p", "\"+p")
vim.keymap.set({"n", "v"}, "<leader>P", "\"+p")
-- increment/decrement a count, helpful for changing indeces -- increment/decrement a count, helpful for changing indeces
vim.keymap.set("n", "+", "<C-a>") vim.keymap.set("n", "+", "<C-a>")

View file

@ -7,9 +7,9 @@ vim.opt.relativenumber = true -- juicy relativity
vim.opt.autoindent = true vim.opt.autoindent = true
vim.opt.smartindent = true vim.opt.smartindent = true
vim.opt.tabstop = 2 vim.opt.tabstop = 4
vim.opt.softtabstop = 2 vim.opt.softtabstop = 4
vim.opt.shiftwidth = 2 vim.opt.shiftwidth = 4
vim.opt.expandtab = true vim.opt.expandtab = true
vim.opt.smarttab = true vim.opt.smarttab = true
vim.opt.breakindent = true vim.opt.breakindent = true

View file

@ -1,94 +1,32 @@
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
-- Only required if you have packer configured as `opt` -- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]] vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function(use) return require('packer').startup(function(use)
-- Packer can manage itself -- Packer can manage itself
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
-- fuzzy finder -- Themes
use 'nvim-lua/plenary.nvim' use({ 'rose-pine/neovim', as = 'rose-pine' })
use {
'nvim-telescope/telescope.nvim', tag = '0.1.0', -- Sweet LSP
requires = { {'nvim-lua/plenary.nvim'} } use {
'VonHeikemen/lsp-zero.nvim',
branch = 'v2.x',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'}, -- Required
{ -- Optional
'williamboman/mason.nvim',
run = function()
pcall(vim.cmd, 'MasonUpdate')
end,
},
{'williamboman/mason-lspconfig.nvim'}, -- Optional
-- Autocompletion
{'hrsh7th/nvim-cmp'}, -- Required
{'hrsh7th/cmp-nvim-lsp'}, -- Required
{'L3MON4D3/LuaSnip'}, -- Required
} }
-- file utilities for telescope }
use { "nvim-telescope/telescope-file-browser.nvim" }
-- colorscheme
use "tjdevries/colorbuddy.nvim"
-- use "svrana/neosolarized.nvim"
use "navarasu/onedark.nvim"
-- treesitter baby
use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' })
-- quick navigation between files, harpoon
use 'ThePrimeagen/harpoon'
use 'mbbill/undotree'
-- git functionalities
use 'tpope/vim-fugitive'
-- LSP configurations
use {
'VonHeikemen/lsp-zero.nvim',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'},
{'williamboman/mason.nvim'},
{'williamboman/mason-lspconfig.nvim'},
-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-buffer'},
{'hrsh7th/cmp-path'},
{'saadparwaiz1/cmp_luasnip'},
{'hrsh7th/cmp-nvim-lsp'},
{'hrsh7th/cmp-nvim-lua'},
-- Snippets
{'L3MON4D3/LuaSnip'},
{'rafamadriz/friendly-snippets'},
}
}
-- Formatter configuration using null-ls
use {
'jose-elias-alvarez/null-ls.nvim',
requires = {
'nvim-lua/plenary.nvim'
}
}
-- status line
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
-- autopairs, complete brackets
use {
"windwp/nvim-autopairs",
config = function() require("nvim-autopairs").setup {} end
}
-- colorize the hex codes
use 'norcalli/nvim-colorizer.lua'
-- markdown preview, sweet
use({
"iamcco/markdown-preview.nvim",
run = function() vim.fn["mkdp#util#install"]() end,
})
-- zen mode, mmmmmm
use "folke/zen-mode.nvim"
-- auto closing tags
use "windwp/nvim-ts-autotag"
-- python indentation
use "Vimjas/vim-python-pep8-indent"
end) end)

View file

@ -0,0 +1 @@
vim.cmd('colorscheme rose-pine')