1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00

vps add youcomplete me

This commit is contained in:
shaoying 2018-09-11 23:42:41 +08:00
parent c69887664a
commit b3ed6e64d7
7 changed files with 101 additions and 33 deletions

View File

@ -1,6 +1,6 @@
login root root
~aaa
login load var/login.txt
# login load var/login.txt
~file1
history load var/history.txt

View File

@ -118,9 +118,7 @@ func (aaa *AAA) Start(m *ctx.Message, arg ...string) bool { // {{{
from := msg.Option("username")
m.Log("lark", "%v", msg.Meta["detail"])
m.Travel(func(m *ctx.Message, n int) bool {
m.Log("fuck", "why-%v=%v", m.Cap("username"), msg.Detail(1))
if m.Cap("username") == msg.Detail(1) {
m.Log("fuck", "why-%v=%v", m.Cap("username"), msg.Detail(1))
m.Confv("lark", strings.Join([]string{from, "-2"}, "."),
map[string]interface{}{"time": msg.Time(), "type": "recv", "text": msg.Detail(2)})
}
@ -206,14 +204,13 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
if aaa, ok := c.Server.(*AAA); m.Assert(ok) { // {{{
stream := ""
method := ""
username := ""
m.Log("fuck", "%s %s", method, username)
// method := ""
// username := ""
if len(arg) > 0 {
switch arg[0] {
case "openid":
method = arg[0]
username = arg[1]
// method = arg[0]
// username = arg[1]
stream = arg[1]
}
}

View File

@ -986,7 +986,10 @@ func (m *Message) Echo(str string, arg ...interface{}) *Message { // {{{
// }}}
func (m *Message) Color(color int, str string, arg ...interface{}) *Message { // {{{
if str = fmt.Sprintf(str, arg...); m.Options("terminal_color") {
if len(arg) > 0 {
str = fmt.Sprintf(str, arg...)
}
if m.Options("terminal_color") {
str = fmt.Sprintf("\033[%dm%s\033[0m", color, str)
}
return m.Add("result", str)
@ -2899,7 +2902,7 @@ var Index = &Context{Name: "ctx", Help: "模块中心",
"command": &Command{
Name: "command [all|add cmd arg...|list [begin [end]]|test [begin [end]]|delete cmd]",
Help: "查看或修改命令",
Form: map[string]int{"condition": -1, "list_help": 1},
Form: map[string]int{"list_name": 1, "list_help": 1, "condition": -1},
Hand: func(m *Message, c *Context, key string, arg ...string) {
if len(arg) == 0 { // {{{
keys := []string{}
@ -2941,6 +2944,7 @@ var Index = &Context{Name: "ctx", Help: "模块中心",
if m.target.Commands == nil {
m.target.Commands = map[string]*Command{}
}
m.target.Commands[m.Cap("list_count")] = &Command{
Name: strings.Join(arg[1:], " "),
Help: m.Confx("list_help"),
@ -2961,6 +2965,11 @@ var Index = &Context{Name: "ctx", Help: "模块中心",
m.Copy(msg, "result").Copy(msg, "append")
},
}
if m.Has("list_name") {
m.target.Commands[m.Option("list_name")] = m.target.Commands[m.Cap("list_count")]
}
m.Capi("list_count", 1)
return
case "list":

View File

@ -919,10 +919,10 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
//权限检查
dir := m.Option("dir", path.Join(m.Cap("directory"), "local", m.Option("username"), m.Option("dir", strings.TrimPrefix(m.Option("path"), "/index"))))
if check := m.Spawn(c).Cmd("/check", "command", "/index/", "dir", dir); !check.Results(0) {
m.Copy(check, "append")
return
}
// if check := m.Spawn(c).Cmd("/check", "command", "/index/", "dir", dir); !check.Results(0) {
// m.Copy(check, "append")
// return
// }
//执行命令
if m.Has("details") {
@ -953,10 +953,10 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
// }}}
}},
"/create": &ctx.Command{Name: "/create", Help: "创建目录或文件", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
if check := m.Spawn().Cmd("/share", "/upload", "dir", m.Option("dir")); !check.Results(0) { // {{{
m.Copy(check, "append")
return
}
// if check := m.Spawn().Cmd("/share", "/upload", "dir", m.Option("dir")); !check.Results(0) { // {{{
// m.Copy(check, "append")
// return
// }
r := m.Optionv("request").(*http.Request)
if m.Option("method") == "POST" {

View File

@ -4,6 +4,7 @@ function jumpto(url) {
}
location.href=url;
}
function keyup(event) {
console.log(event);
if (typeof window.control == "function") {
@ -23,6 +24,7 @@ function keyup(event) {
}
return true
}
document.onkeyup = keyup;
function toggle() {
window.list_hide = !window.list_hide;
@ -42,6 +44,7 @@ function toggle() {
content.style.width="85%";
}
}
function menu() {
var max = 0;
var min = 1000;
@ -144,6 +147,7 @@ function menu() {
}
}
}
function query(event) {
if (event) {
if (event.code == "Enter") {
@ -164,10 +168,12 @@ function query(event) {
input.style.width = "0px";
}
}
var tags_list = {};
ctx.GET("/wiki/define.json", undefined, function(msg){
tags_list = msg["define"];
})
function tags(event) {
console.log(event);
@ -184,6 +190,7 @@ function tags(event) {
}
}
}
document.onmouseup = tags;
window.onload = function() {
toggle();

View File

@ -147,17 +147,17 @@
padding-left:10px;
}
.number1 {
line-height:15px;
padding:10px;
line-height:15px;
padding:5px;
float:left;
margin-left:0px;
font-size:13px;
font-family:monospace;
background-color:#f8f8f8;
border:solid 1px green;
}
.number1 div {
color:#999;
color:#999;
text-align:right;
margin:0;
padding:0;

View File

@ -1,4 +1,4 @@
## 0. 简介
## 简介
zsh 和bash一样是一种终端的shell但提供了更丰富的功能更快捷的补全。
@ -12,7 +12,7 @@ vim 是一款强大的编辑器,通过模式化快捷键提升编辑速度,
- Mac包管理器: <https://brew.sh/>
### 0.1 zsh安装
### zsh安装
Mac上自带zsh不用安装但Ubuntu上需要自己安装一下。
```
$ sudo apt-get install zsh
@ -25,7 +25,7 @@ $ chsh -s /usr/bin/zsh
```
$ curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
```
### 0.2 tmux安装
### tmux安装
Ubuntu上安装
```
$ sudo apt-get install tmux
@ -42,21 +42,76 @@ $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/maste
```
$ tmux
```
### 0.3 vim安装
### vim安装
Mac上自带vim不需要安装但Ubuntu需要自己安装一下。
```
$ sudo apt-get install vim
```
vim有很丰富的插件可以下载一个插件管理器。
vim通过丰富的插件可以扩展很多功能定制出完全个性化的编辑器。
但大量的插件手动维护太复杂,可以下载一个[vim插件管理器vundle](https://github.com/VundleVim/Vundle.vim)。
```
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
```
## 1. 基本快捷键
### 1.1 zsh使用
### 1.2 tmux使用
### 1.3 vim使用
## 2. 个性化配置
## 3. 源码解析
启用vundle插件管理。
```
$ vi ~/.vimrc
filetype off
set nocompatible
set rtp+=~/.vim/bundle/vundle/
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
call vundle#end()
filetype plugin indent on
```
### vim源码安装
参考博客: [vim源码安装](https://www.jianshu.com/p/3e606e31da5f)
```
$ sudo apt-get install python-dev
$ sudo apt-get install python3-dev
$ sudo apt-get install libncurses5-dev
$ git clone git@github.com:vim/vim.git && cd vim
$ sudo mkdir /usr/local/vim8
$ ./configure --with-features=huge\
--enable-pythoninterp\
--enable-python3interp\
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/\
--with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/\
--enable-luainterp\
--enable-perlinterp\
--enable-rubyinterp\
--enable-multibyte\
--prefix=/usr/local/vim8/
$ make
$ sudo make install
```
### Vundle安装
### YouCompleteMe安装
参考博客: [YouCompete安装](http://www.10tiao.com/html/263/201610/2652564254/1.html)
打开.vimrc配置文件添加插件。
```
$ vim ~/.vimrc
Bundle 'vim-syntastic/syntastic'
Bundle 'Valloric/YouCompleteMe'
```
保存并关闭重新打开vim执行插件安装命令。
```
$ vim
:BundleInstall
```
插件安装成功后,进入目录进行编译。
```
$ sudo apt-get install pylint
$ sudo apt-get install cmake
$ cd ~/.vim/bundle/YouCompleteMe
$ ./install.py --clang-completer
```
## 基本快捷键
### zsh使用
### tmux使用
### vim使用
## 个性化配置
## 源码解析
Mac上安装pip
```
$ sudo easy_install pip