Skip to content

Commit

Permalink
add clash
Browse files Browse the repository at this point in the history
  • Loading branch information
theowenyoung committed Oct 21, 2022
1 parent ebcdbf6 commit c3555cd
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 41 deletions.
14 changes: 12 additions & 2 deletions bin/hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env python3

import http.server

import argparse
import os
class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
Expand All @@ -14,4 +15,13 @@ class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):


if __name__ == '__main__':
http.server.test(HandlerClass=MyHTTPRequestHandler)
parser = argparse.ArgumentParser()
parser.add_argument('--bind', '-b', default='', metavar='ADDRESS',
help='Specify alternate bind address '
'[default: all interfaces]')
parser.add_argument('port', action='store',
default=8000, type=int,
nargs='?',
help='Specify alternate port [default: 8000]')
args = parser.parse_args()
http.server.test(HandlerClass=MyHTTPRequestHandler, port=args.port, bind=args.bind)
2 changes: 1 addition & 1 deletion modules/nvim/files/NvChad/lua/core/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ M.general = {
i = {
-- go to beginning and end
["<C-b>"] = { "<ESC>^i", "beginning of line" },
["<C-e>"] = { "<End>","end of line"},
["<C-e>"] = { "<End>", "end of line" },

-- navigate within insert mode
["<C-h>"] = { "<Left>", "move left" },
Expand Down
85 changes: 56 additions & 29 deletions modules/nvim/files/NvChad/lua/custom/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,55 @@ local M = {}
local function termcodes(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
M.disabled = {
n = {
["<leader>x"] = "",
},
}

-- h(elllllll)

-- general
M.general = {
n = {
[";"] = { ":", "command mode", opts = { nowait = true } },
["<Space>ex"] = { ":%bd|e#<CR>", "close all buffers but this one" },
["<Space>X"] = { ":bufdo bd<CR>", "close all buffers" },
["<Space>X"] = { ":%bd|e#<CR>", "close all buffers but this one" },
["C-M-w"] = { "<C-w>", "open window manager" },
["gx"] = { ":!open <c-r><c-a><CR>", "open url", opts = {
silent = true,
} },
-- ["gx"] = { ":!open <c-r><c-a><CR>", "open url", opts = {
-- silent = true,
-- } },
["qq"] = { ":q<CR>", "quit" },
["<Leader>w"] = { ":w<CR>", "save filee" },
["<D-s>"] = { ":w<CR>", "save file" },
["<BS>"] = { "<C-^>", "toggle last buffer" },
["<Leader>be"] = { ":%bd|e#<CR>", "close all other buffers except the current one" },
["<leader>x"] = { [["+x]], "delete with cut" },
["<Leader>d"] = { [["+d]], "delete with cut" },
["<Leader>c"] = { [["+c]], "change with cut" },
["<Leader>D"] = { [["+D]], "delete with cut" },
["<Leader>s"] = { ":%sno/", "substitute exactly" },
["x"] = { [["_x]], "delete not cut" },
["d"] = { [["_d]], "delete not cut" },
["c"] = { [["_c]], "change not cut" },
["D"] = { [["_D]], "delete not cut" },
["<Leader>x"] = { [[""x]], "delete with cut" },
["<Leader>d"] = { [[""d]], "delete with cut" },
["<Leader>c"] = { [[""c]], "change with cut" },
["<Leader>D"] = { [[""D]], "delete with cut" },
["<Leader>s"] = { ":%sno/", "substitute exactly" },
-- close buffer + hide terminal buffer
["<leader><BS>"] = {
function()
require("nvchad_ui.tabufline").close_buffer()
end,
"close buffer",
},
},
x = {
["x"] = { [["_x]], "delete ../../ not cut" },
["d"] = { [["_d]], "delete not cut" },
["c"] = { [["_c]], "change not cut" },
["D"] = { [["_D]], "delete not cut" },
["<Leader>x"] = { [[""x]], "delete with cut" },
["<Leader>d"] = { [[""d]], "delete with cut" },
["<Leader>c"] = { [[""c]], "change with cut" },
["<Leader>D"] = { [[""D]], "delete with cut" },
["<leader>x"] = { [["+x]], "delete with cut" },
["<Leader>d"] = { [["+d]], "delete with cut" },
["<Leader>c"] = { [["+c]], "change with cut" },
["<Leader>D"] = { [["+D]], "delete with cut" },
["<C-r>"] = { [["hy:%s/<C-r>h//g<left><left>]], "replace selected word" },
},
i = {
["<C-s>"] = { "<ESC>:w<CR>", "save file" },
Expand All @@ -52,25 +67,31 @@ M.general = {
["<C-n>"] = { termcodes "<C-\\><C-N>" .. "<cmd> NvimTreeToggle <CR>", "switch right window" },
},
}
M.nvim_spectre = {

M.open_url = {
n = {
["gx"] = { "<Plug>(open-url-browser)", "open url", opts = {
silent = true,
} },
},
x = {
["gx"] = { "<Plug>(open-url-browser)", "open url", opts = {
silent = true,
} },
},
}

M.far = {
n = {
["<Leader>S"] = {
'<cmd>lua require("spectre").open()<CR>',
"open spectre find and replace",
},
["<Leader>sw"] = {
'<esc>:lua require("spectre").open_visual()<CR>',
"open spectre find current word",
},
["<Leader>ss"] = {
'viw:lua require("spectre").open_file_search()<cr>',
"open spectre find current file",
":Farr<cr>",
"find and replace, substitute",
},
},
v = {
x = {
["<Leader>S"] = {
'<esc>:lua require("spectre").open_visual()<CR>',
"open spectre find current word",
":Farr<cr>",
"find current word, and replace",
},
},
}
Expand Down Expand Up @@ -109,9 +130,15 @@ M.lsp_config = {
"lsp formatting",
},
["<leader>e"] = {
"<cmd>lua vim.lsp.diagnostic.get_line_diagnostics()<CR>",
function()
vim.diagnostic.open_float()
end,
"show line diagnostics",
},
["<leader>E"] = {
"<cmd>Telescope diagnostics<CR>",
"show all lsp error",
},
},
}
-- more keybinds!
Expand Down
3 changes: 3 additions & 0 deletions modules/nvim/files/NvChad/lua/custom/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ local opt = vim.opt
local g = vim.g
local wo = vim.wo

-- hide cmd line
opt.cmdheight = 0

-- auto reload
opt.autoread = true

Expand Down
29 changes: 24 additions & 5 deletions modules/nvim/files/NvChad/lua/custom/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ return {
require("exrc").setup()
end,
},
["alexghergh/nvim-tmux-navigation"] = {
config = function()
local nvim_tmux_nav = require "nvim-tmux-navigation"
nvim_tmux_nav.setup {
disable_when_zoomed = true, -- defaults to false
}
vim.keymap.set("n", "<C-h>", nvim_tmux_nav.NvimTmuxNavigateLeft)
vim.keymap.set("n", "<C-j>", nvim_tmux_nav.NvimTmuxNavigateDown)
vim.keymap.set("n", "<C-k>", nvim_tmux_nav.NvimTmuxNavigateUp)
vim.keymap.set("n", "<C-l>", nvim_tmux_nav.NvimTmuxNavigateRight)
vim.keymap.set("n", "<C-\\>", nvim_tmux_nav.NvimTmuxNavigateLastActive)
vim.keymap.set("n", "<C-Space>", nvim_tmux_nav.NvimTmuxNavigateNext)
end,
},
["ybian/smartim"] = {},
-- ["zbirenbaum/copilot.lua"] = {
-- event = "InsertEnter",
-- config = function()
Expand Down Expand Up @@ -79,11 +94,15 @@ return {
},

-- grep and replace
["windwp/nvim-spectre"] = {
config = function()
require "custom.plugins.nvim-spectre"
end,
},
-- ["windwp/nvim-spectre"] = {
-- config = function()
-- require "custom.plugins.nvim-spectre"
-- end,
-- },
-- grep and replace
["brooth/far.vim"] = {},
-- scratch
["mtth/scratch.vim"] = {},
-- Override plugin definition options
["goolord/alpha-nvim"] = {
disable = false,
Expand Down
2 changes: 1 addition & 1 deletion modules/nvim/files/NvChad/lua/custom/plugins/lspconfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local capabilities = require("plugins.configs.lspconfig").capabilities

local parent_lspconfig = require "lspconfig"

local servers = { "html", "cssls", "tsserver", "clangd", "denols" }
local servers = { "html", "cssls", "tsserver", "clangd", "denols", "prettier" }

local custom_on_attach = function(client, bufnr)
client.server_capabilities.hover = false
Expand Down
4 changes: 2 additions & 2 deletions modules/nvim/files/NvChad/lua/custom/plugins/null-ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ local sources = {

-- webdev stuff
b.formatting.deno_fmt.with {
filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact", "json", "markdown" },
filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact", "json" },
},
b.formatting.prettier.with { filetypes = { "html", "css" } },
b.formatting.prettier.with { filetypes = { "html", "css", "markdown" } },

-- Lua
b.formatting.stylua,
Expand Down
7 changes: 7 additions & 0 deletions modules/nvim/files/NvChad/lua/custom/plugins/overrides.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ M.mason = {
"html-lsp",
"typescript-language-server",
"deno",

-- format
"prettier",

-- shell
"shfmt",
'shellcheck',
},
}

Expand Down
1 change: 1 addition & 0 deletions modules/nvim/files/NvChad/lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local plugins = {
["nvim-lua/plenary.nvim"] = { module = "plenary" },

["lewis6991/impatient.nvim"] = {},
["dhruvasagar/vim-open-url"] = {},

["wbthomason/packer.nvim"] = {
cmd = require("core.lazy_load").packer_cmds,
Expand Down
26 changes: 25 additions & 1 deletion modules/tmux/files/dot_tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ set-option -g status-interval 1
set-option -g status-style bg=black
set-option -g status-style fg=white
set -g status-left '#[fg=green]#H #[default]'
set -g status-right ' #{?client_prefix,#[reverse]<Pre>#[noreverse] ,}"#{=21:pane_title}" %H:%M %Y-%m-%d'
set -g status-right ' #{?client_prefix,#[reverse]<Pre>#[noreverse] ,}%H:%M %Y-%m-%d'
set-option -g pane-active-border-style fg=yellow
set-option -g pane-border-style fg=cyan

Expand All @@ -67,3 +67,27 @@ bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
# Allow the arrow key to be used immediately after changing windows
set-option -g repeat-time 0
set -sg escape-time 1



# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -n 'C-Space' if-shell "$is_vim" 'send-keys C-Space' 'select-pane -t:.+'

bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
bind-key -T copy-mode-vi 'C-Space' select-pane -t:.+

0 comments on commit c3555cd

Please sign in to comment.