Add autoload directory for load user functions
This commit is contained in:
parent
e2da257084
commit
03f246045e
2 changed files with 79 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,4 @@
|
|||
# Папку с плагинами не включаем в коммит
|
||||
autoload/
|
||||
plugged/
|
||||
|
||||
# Своп файлы тоже
|
||||
|
|
79
autoload/justmyrc.vim
Normal file
79
autoload/justmyrc.vim
Normal file
|
@ -0,0 +1,79 @@
|
|||
" === Пользовательские функции ===
|
||||
"Функция получения текущего режима редактора
|
||||
function justmyrc#GetMode()
|
||||
let l:editor_mode = mode()
|
||||
|
||||
let l:editor_modes_list = [
|
||||
\ "NORMAL",
|
||||
\ "COMMAND",
|
||||
\ "INSERT",
|
||||
\ "VISUAL",
|
||||
\ "VISUAL-LINE",
|
||||
\ "VISUAL-BLOCK",
|
||||
\ "REPLACE"
|
||||
\ ]
|
||||
|
||||
if l:editor_mode == "n"
|
||||
return l:editor_modes_list[0]
|
||||
|
||||
elseif l:editor_mode == "c"
|
||||
return l:editor_modes_list[1]
|
||||
|
||||
elseif l:editor_mode == "i"
|
||||
return l:editor_modes_list[2]
|
||||
|
||||
elseif l:editor_mode == "v"
|
||||
return l:editor_modes_list[3]
|
||||
elseif l:editor_mode == "V"
|
||||
return l:editor_modes_list[4]
|
||||
elseif l:editor_mode =="\<C-v>"
|
||||
return l:editor_modes_list[5]
|
||||
|
||||
elseif l:editor_mode == "R"
|
||||
return l:editor_modes_list[6]
|
||||
|
||||
else
|
||||
echo l:editor_mode
|
||||
return "?MODE"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function justmyrc#TabLine()
|
||||
let l:s = ''
|
||||
|
||||
for l:i in range(tabpagenr('$'))
|
||||
" Выбираем, какую вкладку подсвечивать
|
||||
if l:i + 1 == tabpagenr()
|
||||
let l:s .= '%#TabLineSel#'
|
||||
else
|
||||
let l:s .= '%#TabLine#'
|
||||
endif
|
||||
|
||||
"Указываем номер вкладки
|
||||
let l:s .= ' ' . (i + 1) . ':'
|
||||
|
||||
"Получаем подпись (имя файла) из TabLabel
|
||||
let l:s .= ' %{justmyrc#TabLabel(' . (l:i + 1) . ')} '
|
||||
endfor
|
||||
|
||||
" after the last tab fill with TabLineFill and reset tab page nr
|
||||
let l:s .= '%#TabLineFill#%T'
|
||||
|
||||
return l:s
|
||||
endfunction
|
||||
|
||||
function justmyrc#TabLabel(n)
|
||||
let l:buflist = tabpagebuflist(a:n)
|
||||
let l:winnr = tabpagewinnr(a:n)
|
||||
|
||||
return bufname(buflist[winnr - 1])
|
||||
endfunction
|
||||
|
||||
function justmyrc#LessBehaviour()
|
||||
if (!&modifiable || &ro)
|
||||
set nonumber
|
||||
set nospell
|
||||
set laststatus=0
|
||||
set cmdheight=1
|
||||
endif
|
||||
endfunction
|
Loading…
Reference in a new issue