Skip to content

Commit

Permalink
Merge pull request #409 from lambdalisue/use-const
Browse files Browse the repository at this point in the history
Use `const` instead of `lockvar`
  • Loading branch information
lambdalisue authored Mar 28, 2022
2 parents 085b74e + 93d34cc commit 53d8cf7
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 32 deletions.
21 changes: 7 additions & 14 deletions autoload/fern.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@ let s:root = expand('<sfile>:p:h')
let s:Config = vital#fern#import('Config')

" Define Public constant
let g:fern#STATUS_NONE = 0
let g:fern#STATUS_COLLAPSED = 1
let g:fern#STATUS_EXPANDED = 2
lockvar g:fern#STATUS_NONE
lockvar g:fern#STATUS_COLLAPSED
lockvar g:fern#STATUS_EXPANDED
const g:fern#STATUS_NONE = 0
const g:fern#STATUS_COLLAPSED = 1
const g:fern#STATUS_EXPANDED = 2

let g:fern#DEBUG = 0
let g:fern#INFO = 1
let g:fern#WARN = 2
let g:fern#ERROR = 3
lockvar g:fern#DEBUG
lockvar g:fern#INFO
lockvar g:fern#WARN
lockvar g:fern#ERROR
const g:fern#DEBUG = 0
const g:fern#INFO = 1
const g:fern#WARN = 2
const g:fern#ERROR = 3

" Define Public variables
call s:Config.config(expand('<sfile>:p'), {
Expand Down
12 changes: 4 additions & 8 deletions autoload/fern/logger.vim
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ function! s:format(level, args, sep) abort
endfunction

" For backword compatibility
let g:fern#logger#DEBUG = g:fern#DEBUG
let g:fern#logger#INFO = g:fern#INFO
let g:fern#logger#WARN = g:fern#WARN
let g:fern#logger#ERROR = g:fern#ERROR
lockvar g:fern#logger#DEBUG
lockvar g:fern#logger#INFO
lockvar g:fern#logger#WARN
lockvar g:fern#logger#ERROR
const g:fern#logger#DEBUG = g:fern#DEBUG
const g:fern#logger#INFO = g:fern#INFO
const g:fern#logger#WARN = g:fern#WARN
const g:fern#logger#ERROR = g:fern#ERROR
3 changes: 1 addition & 2 deletions test/behavior/Fern.vimspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Describe Fern
Before all
let l:Join = function('fern#internal#filepath#join')
let workdir = tempname()
lockvar workdir
const workdir = tempname()
call mkdir(Join([workdir, 'deep', 'alpha', 'beta']), 'p')
call mkdir(Join([workdir, 'shallow', 'alpha']), 'p')
call mkdir(Join([workdir, 'shallow', 'beta']), 'p')
Expand Down
3 changes: 1 addition & 2 deletions test/behavior/alternate-file.vimspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Describe alternate-file
Before all
let fern_keepalt_on_edit = g:fern#keepalt_on_edit
let workdir = tempname()
lockvar workdir
const workdir = tempname()
call mkdir(workdir, 'p')
call writefile([], fern#internal#filepath#join([workdir, 'alpha']))
call writefile([], fern#internal#filepath#join([workdir, 'beta']))
Expand Down
3 changes: 1 addition & 2 deletions test/behavior/buffer-rename.vimspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Describe buffer-rename
Before
let workdir = tempname()
lockvar workdir
const workdir = tempname()
call mkdir(workdir, 'p')
call writefile([], fern#internal#filepath#join([workdir, 'alpha']))
call writefile([], fern#internal#filepath#join([workdir, 'beta']))
Expand Down
3 changes: 1 addition & 2 deletions test/behavior/jumplist.vimspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Describe jumplist
Before all
let fern_keepjumps_on_edit = g:fern#keepjumps_on_edit
let workdir = tempname()
lockvar workdir
const workdir = tempname()
call mkdir(workdir, 'p')
call writefile([], fern#internal#filepath#join([workdir, 'alpha']))
call writefile([], fern#internal#filepath#join([workdir, 'beta']))
Expand Down
3 changes: 1 addition & 2 deletions test/behavior/special-characters.vimspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Describe special-characters
Before all
let l:Join = function('fern#internal#filepath#join')
let workdir = tempname()
lockvar workdir
const workdir = tempname()
let candidates = [
\ ';',
\ '#',
Expand Down

0 comments on commit 53d8cf7

Please sign in to comment.