Skip to content

Commit 62c8fa1

Browse files
committed
fix
1 parent 21acfa1 commit 62c8fa1

File tree

5 files changed

+36
-41
lines changed

5 files changed

+36
-41
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
### setup
1414
#### ubuntu
1515
```bash
16-
./init.sh --with_php --with_c --with_vim_go --with_java \
16+
./init.sh --with_php --with_cpp --with_go --with_python --with_java \
1717
--with_lua --with_leetcode --with_man --with_dict --with_bash
1818
```
1919
#### mac and centos
@@ -26,5 +26,7 @@
2626

2727

2828
### language server
29-
3029
> use coc.nvim for lsp client
30+
31+
### leetcode supported langage
32+
> java cpp and golang

helper/option.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
OPT_PHP=
2-
OPT_C=
3-
OPT_VIM_GO=
2+
OPT_CPP=
3+
OPT_GO=
44
OPT_JAVA=
55
OPT_LUA=
66
OPT_PYTHON=
@@ -14,8 +14,8 @@ for option
1414
do
1515
case "$option" in
1616
--with_php) OPT_PHP=yes ;;
17-
--with_c) OPT_C=yes ;;
18-
--with_vim_go) OPT_VIM_GO=yes ;;
17+
--with_cpp) OPT_CPP=yes ;;
18+
--with_go) OPT_GO=yes ;;
1919
--with_java) OPT_JAVA=yes ;;
2020
--with_lua) OPT_LUA=yes ;;
2121
--with_python) OPT_PYTHON=yes ;;

tools/dep/ubuntu_init.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if [ "Y$OPT_DICT" == "Yyes" ];then
2525
fi
2626

2727
#install clangd8 url:https://apt.llvm.org/
28-
if [ "Y$OPT_C" == "Yyes" ];then
28+
if [ "Y$OPT_CPP" == "Yyes" ];then
2929
! ( grep -F "llvm-toolchain-" /etc/apt/sources.list ) && \
3030
cat >> /etc/apt/sources.list <<END
3131
# clangd
@@ -44,7 +44,7 @@ END
4444
sudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-8 100
4545
fi
4646

47-
if [ "Y$OPT_C" == "Yyes" ];then
47+
if [ "Y$OPT_CPP" == "Yyes" ];then
4848
apt-get install -y \
4949
valgrind clang-format cscope gdb
5050
fi

tools/neovim/init.vim

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,6 @@ map J <Plug>(expand_region_shrink)
8484
map <leader>n :Defx<CR>
8585
map <leader>m :TagbarOpenAutoClose<CR>
8686
87-
"----------------------------------------------
88-
" Language: Golang
89-
"----------------------------------------------
90-
" Run goimports when running gofmt
91-
let g:go_fmt_command = "goimports"
92-
let g:go_version_warning = 0
93-
let g:go_highlight_build_constraints = 1
94-
let g:go_highlight_extra_types = 1
95-
let g:go_highlight_fields = 1
96-
let g:go_highlight_functions = 1
97-
let g:go_highlight_methods = 1
98-
let g:go_highlight_operators = 1
99-
let g:go_highlight_structs = 1
100-
let g:go_highlight_types = 1
101-
10287
func! RunProgram()
10388
exec "w"
10489
if &filetype == 'c'
@@ -168,13 +153,6 @@ function! LoadCscope()
168153
endfunction
169154
au BufEnter /* call LoadCscope()
170155

171-
let g:ycm_server_python_interpreter = '/usr/bin/python'
172-
let g:ycm_python_binary_path = '/usr/bin/python3'
173-
let g:ycm_key_invoke_completion = '<C-a>'
174-
let g:ycm_global_ycm_extra_conf='~/.config/nvim/ycm.cpp.py'
175-
autocmd FileType c let g:ycm_global_ycm_extra_conf='~/.config/nvim/ycm.c.py'
176-
autocmd FileType cpp let g:ycm_global_ycm_extra_conf='~/.config/nvim/ycm.cpp.py'
177-
178156
" for debug
179157
set nu
180158
set list
@@ -204,14 +182,9 @@ highlight DbgBreakptLine ctermbg=none ctermfg=none
204182
highlight DbgBreakptSign ctermbg=none ctermfg=10
205183
highlight DbgCurrentLine ctermbg=none ctermfg=none
206184
highlight DbgCurrentSign ctermbg=none ctermfg=red
207-
" snips
208-
" UltiSnips 的 tab 键与 YCM 冲突,重新设定
209-
let g:UltiSnipsExpandTrigger="<leader><tab>"
210-
let g:UltiSnipsJumpForwardTrigger="<leader><tab>"
211-
let g:UltiSnipsJumpBackwardTrigger="<leader><s-tab>"
185+
212186
nnoremap <leader>y :call system('NCCOMMAND NCHOST 8377', @0)<CR>
213187
nnoremap <leader>] :call fzf#vim#tags('^' . expand('<cword>'), {'options': '--exact --select-1 --exit-0 +i'})<CR>
214-
215188
" color change fix in tmux
216189
set t_Co=256
217190
"switch windows
@@ -240,8 +213,6 @@ endif
240213
set scrolloff=5
241214
let g:header_auto_add_header = 0
242215

243-
let g:ycm_show_diagnostics_ui = 0
244-
245216
let g:tmux_navigator_no_mappings = 1
246217
nnoremap <silent> <C-h> :TmuxNavigateLeft<cr>
247218
nnoremap <silent> <C-k> :TmuxNavigateUp<cr>
@@ -279,6 +250,7 @@ if has("persistent_undo")
279250
set undodir=~/.undodir/
280251
set undofile
281252
endif
253+
282254
" tab 替换为4个空格
283255
set tabstop=4
284256
set shiftwidth=4

tools/neovim/ubuntu_init.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,30 @@ function leetcode_ins(){
1313
! (grep -F 'leetcode' ~/.config/nvim/init.vim &>/dev/null ) && \
1414
pip3 install requests beautifulsoup4 && \
1515
sed -i "/plug#begin/aPlug 'ianding1/leetcode.vim'" ~/.config/nvim/init.vim
16+
17+
! ( grep -F "LeetCodeList" ~/.config/nvim/init.vim ) && \
18+
cat >> ~/.config/nvim/init.vim <<END
19+
nnoremap <leader>ll :LeetCodeList<cr>
20+
nnoremap <leader>lt :LeetCodeTest<cr>
21+
nnoremap <leader>ls :LeetCodeSubmit<cr>
22+
nnoremap <leader>li :LeetCodeSignIn<cr>
23+
END
1624
}
1725

1826
function python_ins(){
1927
! ( grep -F "python.linting.enabled" ~/.config/nvim/coc-settings.json ) && \
2028
sed -i '/suggest.timeout/i "python.linting.enabled": false,' ~/.config/nvim/coc-settings.json
29+
! ( grep -F "leetcode_solution_filetype" ~/.config/nvim/init.vim ) && \
30+
cat >> ~/.config/nvim/init.vim <<END
31+
let g:leetcode_solution_filetype=python3
32+
END
33+
2134
}
2235
function java_ins(){
23-
echo "java ins"
36+
! ( grep -F "leetcode_solution_filetype" ~/.config/nvim/init.vim ) && \
37+
cat >> ~/.config/nvim/init.vim <<END
38+
let g:leetcode_solution_filetype=java
39+
END
2440
}
2541
function lua_ins(){
2642
! ( grep -F "languageserver" ~/.config/nvim/coc-settings.json ) && \
@@ -44,6 +60,11 @@ function go_ins(){
4460

4561
! ( grep -F "languageserver" ~/.config/nvim/coc-settings.json ) && \
4662
sed -i '/suggest.timeout/i "languageserver": {\n"golang": {\n"command": "gopls",\n"filetypes": ["go"]\n}\n},' ~/.config/nvim/coc-settings.json
63+
! ( grep -F "leetcode_solution_filetype" ~/.config/nvim/init.vim ) && \
64+
cat >> ~/.config/nvim/init.vim <<END
65+
let g:leetcode_solution_filetype=golang
66+
END
67+
4768
}
4869

4970
function php_ins(){
@@ -117,15 +138,15 @@ fi
117138

118139
#language
119140

120-
if [ "Y$OPT_VIM_GO" == "Yyes" ];then
141+
if [ "Y$OPT_GO" == "Yyes" ];then
121142
go_ins
122143
fi
123144

124145
if [ "Y$OPT_PHP" == "Yyes" ];then
125146
php_ins
126147
fi
127148

128-
if [ "Y$OPT_C" == "Yyes" ];then
149+
if [ "Y$OPT_CPP" == "Yyes" ];then
129150
c_ins
130151
fi
131152

0 commit comments

Comments
 (0)