aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2021-07-10 22:56:23 +0000
committerterminaldweller <thabogre@gmail.com>2021-07-10 22:56:23 +0000
commit4ed623d52ff73c70be739a476daa12f58ddf7e46 (patch)
tree0e11c7efa44dee99f5efaf0ebcac80087d3fec80
parentupdate (diff)
downloadscripts-4ed623d52ff73c70be739a476daa12f58ddf7e46.tar.gz
scripts-4ed623d52ff73c70be739a476daa12f58ddf7e46.zip
switch between vim and tmux with c-w c-w. feels comfy. changed diasm into actual asm for c and c++ in the makefiles. some more things for vim.
-rw-r--r--.tmux.conf13
-rw-r--r--.vimrc25
-rwxr-xr-xbin/exclude_ip_list3
-rw-r--r--makefilec11
-rw-r--r--makefilecpp9
5 files changed, 35 insertions, 26 deletions
diff --git a/.tmux.conf b/.tmux.conf
index a5eadec..2df1ba3 100644
--- a/.tmux.conf
+++ b/.tmux.conf
@@ -65,6 +65,8 @@ bind -T off F6 \
wg_is_keys_off="#[fg=colour15,bg=colour63,bold]#([ $(tmux show-option -qv key-table) = 'off' ] && echo 'OFF')#[fg=colour22] #{?#{pane_ssh_connected},#[fg=colour63 bg=colour24],#[fg=colour63 bg=colour31]}#[default]"
+# from christoomey's vim-tmux-nivagator
+is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
#key bindings
#do not use alt keybindings. because of the escape passed at the beginning of a alt keycode,
#zsh's vim mode's escape becomes slow since tmux will have to wait on keybindings beginning with escape.
@@ -74,6 +76,9 @@ bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
+# bind -n C-w-w select-pane -l
+bind-key -Ttable1 'C-w' if-shell "$is_vim" 'send-keys C-w' 'select-pane -l'
+bind-key -Troot 'C-w' if-shell "$is_vim" 'send-keys C-w' 'switch-client -Ttable1'
# bind -n S-Right next-window
# bind -n S-Left previous-window
bind -n C-k next-window
@@ -82,10 +87,10 @@ bind -n C-j previous-window
# bind -n M-Down select-pane -D
# bind -n M-Left select-pane -L
# bind -n M-Right select-pane -R
-bind -r C-k select-pane -U
-bind -r C-j select-pane -D
-bind -r C-h select-pane -L
-bind -r C-l select-pane -R
+# bind -r C-k select-pane -U
+# bind -r C-j select-pane -D
+# bind -r C-h select-pane -L
+# bind -r C-l select-pane -R
setw -g mode-keys vi
bind [ copy-mode
bind -T copy-mode-vi 'v' send -X begin-selection
diff --git a/.vimrc b/.vimrc
index 12ca145..76a322b 100644
--- a/.vimrc
+++ b/.vimrc
@@ -136,7 +136,6 @@ Plugin 'rgrinberg/vim-ocaml'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'kshenoy/vim-signature'
Plugin 'Konfekt/vim-scratchpad'
-Plugin 'tmux-plugins/vim-tmux'
Plugin 'rust-lang/rust.vim'
Plugin 'tpope/vim-repeat'
Plugin 'cespare/vim-toml'
@@ -176,13 +175,16 @@ Plugin 'hail2u/vim-css3-syntax'
Plugin 'chrisbra/unicode.vim'
Plugin 'meatballs/vim-xonsh'
Plugin 'junegunn/gv.vim'
+Plugin 'ap/vim-css-color'
+Plugin 'christoomey/vim-tmux-navigator'
+Plugin 'Shirk/vim-gas'
+" Plugin 'tmux-plugins/vim-tmux'
" Plugin 'rhysd/vim-gfm-syntax'
" Plugin 'vim-utils/vim-troll-stopper'
" Plugin 'vim-pandoc/vim-pandoc'
" Plugin 'vim-pandoc/vim-pandoc-syntax'
" Plugin 'tmux-plugins/vim-tmux-focus-events'
" Plugin 'skammer/vim-css-color'
-" Plugin 'christoomey/vim-tmux-navigator'
" Plugin 'jelera/vim-javascript-syntax'
" Plugin 'szymonmaszke/vimpyter'
" Plugin 'puremourning/vimspector'
@@ -327,7 +329,7 @@ au BufEnter,FileType c set syntax=cpp.doxygen
au BufNewFile,BufRead .muttrc set filetype=neomuttrc
au BufNewFile,BufRead,BufEnter *.toml set filetype=toml
-au BufNewFile,BufEnter *.s set ft=nasm
+au BufNewFile,BufEnter,BufRead *.s set ft=gas
au BufEnter,FileType *.wast set syntax=wast
au BufEnter,FileType *.wat set syntax=wast
au BufEnter,FileType *.uml set syntax=plantuml
@@ -483,16 +485,15 @@ nmap <silent> <leader>q :call ToggleList("Quickfix List", 'c')<CR>
" nmap <silent> <M-h> :wincmd h<CR>
" nmap <silent> <M-l> :wincmd l<CR>
-"vim-tmux-navigator
-" let g:tmux_navigator_no_mappings = 1
-" let g:tmux_navigator_disable_when_zoomed = 1
-" let g:tmux_navigator_save_on_switch = 2
-
+" vim-tmux-navigator
+let g:tmux_navigator_no_mappings = 1
+let g:tmux_navigator_disable_when_zoomed = 1
+let g:tmux_navigator_save_on_switch = 2
" nnoremap <silent> <C-h> :TmuxNavigateLeft<cr>
-" nnoremap <silent> <C-j> :TmuxNavigateDown<cr>
-" nnoremap <silent> <C-k> :TmuxNavigateUp<cr>
-" nnoremap <silent> <C-l> :TmuxNavigateRight<cr>
-" nnoremap <silent> {Previous-Mapping} :TmuxNavigatePrevious<cr>
+nnoremap <silent> <C-j> :TmuxNavigateDown<cr>
+nnoremap <silent> <C-k> :TmuxNavigateUp<cr>
+nnoremap <silent> <C-l> :TmuxNavigateRight<cr>
+nnoremap <silent> <C-w><C-w> :TmuxNavigatePrevious<cr>
"vim.session options
let g:session_directory = "~/.vim/session"
diff --git a/bin/exclude_ip_list b/bin/exclude_ip_list
index 8ddd42e..a4df77b 100755
--- a/bin/exclude_ip_list
+++ b/bin/exclude_ip_list
@@ -3,7 +3,8 @@ from ipaddress import ip_network
start = '0.0.0.0/0'
exclude = ['127.0.0.1', '192.168.1.0/24',
- '185.126.202.69', '87.236.209.206', '185.126.202.69', '94.182.18.223']
+ '185.126.202.69', '87.236.209.206', '185.126.202.69',
+ '94.182.18.223']
result = [ip_network(start)]
for x in exclude:
diff --git a/makefilec b/makefilec
index 3fe1eff..2943ae7 100644
--- a/makefilec
+++ b/makefilec
@@ -29,7 +29,7 @@ EXCLUSION_LIST='xxxxxx'
OBJ_LIST:=$(patsubst %.c, %.o, $(shell find . -name '*.c' | grep -Ev $(EXCLUSION_LIST)))
OBJ_COV_LIST:=$(patsubst %.c, %.ocov, $(shell find . -name '*.c' | grep -Ev $(EXCLUSION_LIST)))
OBJ_DBG_LIST:=$(patsubst %.c, %.odbg, $(shell find . -name '*.c' | grep -Ev $(EXCLUSION_LIST)))
-ASM_LIST:=$(patsubst %.c, %.dis, $(shell find . -name '*.c' | grep -Ev $(EXCLUSION_LIST)))
+ASM_LIST:=$(patsubst %.c, %.s, $(shell find . -name '*.c' | grep -Ev $(EXCLUSION_LIST)))
WASM_LIST:=$(patsubst %.c, %.wasm, $(shell find . -name '*.c' | grep -Ev $(EXCLUSION_LIST)))
WAST_LIST:=$(patsubst %.c, %.wast, $(shell find . -name '*.c' | grep -Ev $(EXCLUSION_LIST)))
IR_LIST:=$(patsubst %.c, %.ir, $(shell find . -name '*.c' | grep -Ev $(EXCLUSION_LIST)))
@@ -149,8 +149,9 @@ tags:$(SRCS)
sed -e 's/[\\ ]/\n/g'|sed -e '/^$$/d' -e '/\.o:[ \t]*$$/d'|\
ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q)
-%.dis: %.o
- objdump -r -d -M intel -S $< > $@
+%.s: %.c
+ $(CC) -S $< -o $@
+ # objdump -r -d -M intel -S $< > $@
%.ir: %.c
$(CC) -emit-llvm -S -o $@ $<
@@ -183,7 +184,7 @@ test: $(TARGET)
$(TARGET)
run: $(TARGET)
- $(TARGET)
+ "./$(TARGET)"
valgrind: $(TARGET)
- valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all $(TARGET)
@@ -198,7 +199,7 @@ format:
- clang-format -i $(SRCS) $(HDRS)
clean:
- - rm -f *.o *.dis *.odbg *.ocov *.js *.ir *~ $(TARGET) $(TARGET).so $(TARGET)-static \
+ - rm -f *.o *.s *.odbg *.ocov *.js *.ir *~ $(TARGET) $(TARGET).so $(TARGET)-static \
$(TARGET)-dbg $(TARGET).a $(TARGET)-cov *.wasm *.wast $(TARGET).adbg *.ast
deepclean: clean
diff --git a/makefilecpp b/makefilecpp
index 8855fa8..7bcb7fa 100644
--- a/makefilecpp
+++ b/makefilecpp
@@ -29,7 +29,7 @@ EXCLUSION_LIST='xxxxxx'
OBJ_LIST:=$(patsubst %.cpp, %.o, $(shell find . -name '*.cpp' | grep -Ev $(EXCLUSION_LIST)))
OBJ_COV_LIST:=$(patsubst %.cpp, %.ocov, $(shell find . -name '*.cpp' | grep -Ev $(EXCLUSION_LIST)))
OBJ_DBG_LIST:=$(patsubst %.cpp, %.odbg, $(shell find . -name '*.cpp' | grep -Ev $(EXCLUSION_LIST)))
-ASM_LIST:=$(patsubst %.cpp, %.dis, $(shell find . -name '*.cpp' | grep -Ev $(EXCLUSION_LIST)))
+ASM_LIST:=$(patsubst %.cpp, %.s, $(shell find . -name '*.cpp' | grep -Ev $(EXCLUSION_LIST)))
WASM_LIST:=$(patsubst %.cpp, %.wasm, $(shell find . -name '*.cpp' | grep -Ev $(EXCLUSION_LIST)))
WAST_LIST:=$(patsubst %.cpp, %.wast, $(shell find . -name '*.cpp' | grep -Ev $(EXCLUSION_LIST)))
IR_LIST:=$(patsubst %.cpp, %.ir, $(shell find . -name '*.cpp' | grep -Ev $(EXCLUSION_LIST)))
@@ -154,8 +154,9 @@ tags:$(SRCS)
sed -e 's/[\\ ]/\n/g'|sed -e '/^$$/d' -e '/\.o:[ \t]*$$/d'|\
ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q)
-%.dis: %.o
- objdump -r -d -M intel -S $< > $@
+%.s: %.cpp
+ $(CXX) -S $< -o $@
+ # objdump -r -d -M intel -S $< > $@
%.ir: %.cpp
$(CXX) -emit-llvm -S -o $@ $<
@@ -188,7 +189,7 @@ test: $(TARGET)
$(TARGET)
run: $(TARGET)
- $(TARGET)
+ "./$(TARGET)"
valgrind: $(TARGET)
- valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all $(TARGET)